[enh] Add --dev option to gulp tasks tp prevent time consuming compression.

This commit is contained in:
opi 2016-04-28 16:18:07 +02:00
parent 3595b6c5af
commit 5df9eef1b0
3 changed files with 14 additions and 4 deletions

View file

@ -28,6 +28,8 @@ bower install
npm install -g gulp
gulp build
```
Alternatively you can pas the `--dev` option to gulp which improve building
speed by bypassing compression tasks.
## Dependencies

View file

@ -11,8 +11,14 @@ var concat = require('gulp-concat'),
cssmin = require('gulp-cssmin'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename')
util = require('gulp-util')
gulpif = require('gulp-if')
;
// Environment variables
isDev = (util.env.dev) ? true : false;
isProduction = !isDev;
// Global build task
gulp.task('build', [
'css',
@ -46,7 +52,7 @@ gulp.task('js', function() {
'js/yunohost/filters.js',
'js/yunohost/controllers/*.js',
])
.pipe(uglify())
.pipe(gulpif(isProduction, uglify()))
.pipe(concat('script.min.js'))
.pipe(gulp.dest('./dist/js'))
});
@ -85,7 +91,7 @@ gulp.task('css', function () {
.pipe(rename({
suffix: '.min'
}))
.pipe(cssmin())
.pipe(gulpif(isProduction, cssmin()))
.pipe(gulp.dest('./dist/css'))
});
@ -104,6 +110,6 @@ gulp.task('css-lint', function() {
// Images task
gulp.task('img', function () {
return gulp.src('img/*')
.pipe(imagemin())
.pipe(gulpif(isProduction, imagemin()))
.pipe(gulp.dest('./dist/img'))
});

View file

@ -12,16 +12,18 @@
},
"homepage": "https://github.com/YunoHost/yunohost-admin",
"devDependencies": {
"bower": "^1.7.7",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-csslint": "^0.2.0",
"gulp-cssmin": "^0.1.7",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^2.3.0",
"gulp-jshint": "^1.11.2",
"gulp-less": "^3.0.3",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.2.0",
"bower": "^1.7.7"
"gulp-util": "^3.0.7"
}
}