Gulp: Only chmod files if in production
This commit is contained in:
15
gulpfile.js
15
gulpfile.js
@@ -15,12 +15,13 @@ var sourcemaps = require('gulp-sourcemaps');
|
|||||||
var uglify = require('gulp-uglify-es').default;
|
var uglify = require('gulp-uglify-es').default;
|
||||||
|
|
||||||
var enabled = {
|
var enabled = {
|
||||||
uglify: argv.production,
|
chmod: argv.production,
|
||||||
maps: argv.production,
|
|
||||||
failCheck: argv.production,
|
|
||||||
prettyPug: !argv.production,
|
|
||||||
liveReload: !argv.production,
|
|
||||||
cleanup: argv.production,
|
cleanup: argv.production,
|
||||||
|
failCheck: argv.production,
|
||||||
|
liveReload: !argv.production,
|
||||||
|
maps: argv.production,
|
||||||
|
prettyPug: !argv.production,
|
||||||
|
uglify: argv.production,
|
||||||
};
|
};
|
||||||
|
|
||||||
var destination = {
|
var destination = {
|
||||||
@@ -67,7 +68,7 @@ gulp.task('scripts', function() {
|
|||||||
.pipe(gulpif(enabled.uglify, uglify()))
|
.pipe(gulpif(enabled.uglify, uglify()))
|
||||||
.pipe(rename({suffix: '.min'}))
|
.pipe(rename({suffix: '.min'}))
|
||||||
.pipe(gulpif(enabled.maps, sourcemaps.write(".")))
|
.pipe(gulpif(enabled.maps, sourcemaps.write(".")))
|
||||||
.pipe(chmod(644))
|
.pipe(gulpif(enabled.chmod, chmod(644)))
|
||||||
.pipe(gulp.dest(destination.js))
|
.pipe(gulp.dest(destination.js))
|
||||||
.pipe(gulpif(enabled.liveReload, livereload()));
|
.pipe(gulpif(enabled.liveReload, livereload()));
|
||||||
});
|
});
|
||||||
@@ -82,7 +83,7 @@ gulp.task('scripts_tutti', function() {
|
|||||||
.pipe(concat("tutti.min.js"))
|
.pipe(concat("tutti.min.js"))
|
||||||
.pipe(gulpif(enabled.uglify, uglify()))
|
.pipe(gulpif(enabled.uglify, uglify()))
|
||||||
.pipe(gulpif(enabled.maps, sourcemaps.write(".")))
|
.pipe(gulpif(enabled.maps, sourcemaps.write(".")))
|
||||||
.pipe(chmod(644))
|
.pipe(gulpif(enabled.chmod, chmod(644)))
|
||||||
.pipe(gulp.dest(destination.js))
|
.pipe(gulp.dest(destination.js))
|
||||||
.pipe(gulpif(enabled.liveReload, livereload()));
|
.pipe(gulpif(enabled.liveReload, livereload()));
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user