From 018a3072a36fbabc691d55ad9024a1eb91139895 Mon Sep 17 00:00:00 2001 From: Tux Date: Wed, 25 Nov 2015 20:49:28 -0500 Subject: [PATCH] Add gulpfile --- .gitignore | 1 + gulpfile.js | 30 ++++++++++++++++++++++++++++++ package.json | 9 ++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gulpfile.js diff --git a/.gitignore b/.gitignore index 56fe296..2caf7ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ *.log .idea/ +production/ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..7592860 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,30 @@ +var gulp = require('gulp'); +var cssmin = require('gulp-cssmin'); +var uglify = require('gulp-uglify'); +var nodemon = require('gulp-nodemon'); +var gif = require('gulp-if'); + +var inProduction = process.env['NODE_ENV'] == 'production'; + +gulp.task('asset-css', function() { + gulp.src('assets/css/main.css') + .pipe(gif(inProduction, cssmin())) + .pipe(gulp.dest('production/css')); +}); + + +gulp.task('asset-js', function() { + gulp.src('assets/js/*') + .pipe(gif(inProduction, uglify())) + .pipe(gulp.dest('production/js')); +}); + +gulp.task('build', ['asset-css', 'asset-js']); + +gulp.task('watch-app', function() { + nodemon({ + script: 'app.js', + ext: 'js json', + env: {'NODE_ENV': 'development'} + }); +}); diff --git a/package.json b/package.json index 7488536..38e6af0 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,12 @@ "bugs": { "url": "https://github.com/Cryptkeeper/Minetrack/issues" }, - "homepage": "https://github.com/Cryptkeeper/Minetrack#README" + "homepage": "https://github.com/Cryptkeeper/Minetrack#README", + "devDependencies": { + "gulp": "^3.9.0", + "gulp-cssmin": "^0.1.7", + "gulp-if": "^2.0.0", + "gulp-nodemon": "^2.0.4", + "gulp-uglify": "^1.5.1" + } }