diff --git a/README.md b/README.md index 3f58dee..abe4d98 100644 --- a/README.md +++ b/README.md @@ -60,21 +60,24 @@ This is needed for pre-loading the selected profile (unless you allowed local fi ## Build +### Dependencies + Requires [Node and npm](http://nodejs.org/) (or [io.js](https://iojs.org)), [Bower](http://bower.io/) and [Gulp](http://gulpjs.com/): npm install -g bower npm install -g gulp -Install: +### Install npm install bower install -Build: +### Build - gulp + gulp #for release + gulp debug #for development -Develop: +### Develop gulp watch diff --git a/gulpfile.js b/gulpfile.js index 7478b0b..823ff31 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,12 +12,16 @@ var path = require('path'); var cached = require('gulp-cached'); var remember = require('gulp-remember'); var inject = require('gulp-inject'); +var gulpif = require('gulp-if'); +var gutil = require('gulp-util'); + +var debug = false; var paths = { // see overrides in bower.json scriptsConfig: mainBowerFiles('**/url-search-params/**/*.js'), scripts: mainBowerFiles([ - '**/*.js', + '**/*.js', '!**/*.min.js', '!**/url-search-params/**/*.js' ]).concat([ @@ -43,10 +47,15 @@ gulp.task('scripts_config', ['clean'], function() { }); gulp.task('scripts', function() { + if (debug) + gutil.log( gutil.colors.yellow('Running in Debug mode') ); + else + gutil.log( gutil.colors.green('Running in Release mode') ); + return gulp.src(paths.scripts, { base: '.' }) .pipe(sourcemaps.init()) - .pipe(cached('scripts')) - .pipe(uglify()) + .pipe(cached('scripts')) + .pipe(gulpif(!debug, uglify())) .pipe(remember('scripts')) .pipe(concat(paths.destName + '.js')) .pipe(sourcemaps.write('.')) @@ -93,16 +102,17 @@ gulp.task('fonts', ['clean'], function() { gulp.task('clean', function(cb) { del(paths.dest + '/**/*' , cb); -}); +}); gulp.task('watch', function() { + debug = true; var watcher = gulp.watch(paths.scripts, ['scripts']); watcher.on('change', function (event) { if (event.type === 'deleted') { delete cached.caches.scripts[event.path]; remember.forget('scripts', event.path); } - }); + }); }); gulp.task('debug', function() { @@ -125,3 +135,8 @@ gulp.task('inject', function () { }); gulp.task('default', ['clean', 'scripts_config', 'scripts', 'styles', 'images', 'fonts']); + +gulp.task('debug', function() { + debug = true; + gulp.start('default'); +}); \ No newline at end of file diff --git a/package.json b/package.json index 58221f5..c42ff37 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "gulp-sourcemaps": "^1.5.1", "gulp-tap": "^0.1.3", "gulp-uglify": "^1.1.0", + "gulp-if": "^2.0.0", + "gulp-util": "^3.0.7", "main-bower-files": "^2.6.2" } }