| Index: gulpfile.js |
| =================================================================== |
| --- a/gulpfile.js |
| +++ b/gulpfile.js |
| @@ -20,16 +20,17 @@ |
| const gutil = require("gulp-util"); |
| const sourcemaps = require("gulp-sourcemaps"); |
| const rename = require("gulp-rename"); |
| const sass = require("gulp-sass"); |
| const postcss = require("gulp-postcss"); |
| const scss = require("postcss-scss"); |
| const autoprefixer = require("autoprefixer"); |
| const minify = require("gulp-minify"); |
| +const imagemin = require('gulp-imagemin'); |
| /****************************************************************************** |
| * CSS |
| ******************************************************************************/ |
| gulp.task("css", function() { |
| return gulp.src("./static/src/scss/main.scss") |
| .pipe(sourcemaps.init()) |
| @@ -52,21 +53,59 @@ |
| ext: {min:".min.js"}, |
| preserveComments: "some" |
| })) |
| .pipe(sourcemaps.write("./")) |
| .pipe(gulp.dest("./static/dist/js")) |
| }); |
| /****************************************************************************** |
| + * Images |
| + ******************************************************************************/ |
| + |
| +gulp.task("img", function() { |
| + return gulp.src(["./static/src/img/**"]) |
| + .pipe(imagemin([ |
|
juliandoucette
2017/12/14 13:01:44
This could be an expensive process. I wonder if we
ire
2017/12/16 09:59:24
If I go with my suggestion for this task to replac
juliandoucette
2017/12/18 17:11:16
Are you suggesting that we run this task to automa
ire
2017/12/20 08:44:20
Yes. Since the gulp task is watching the src/img d
|
| + imagemin.svgo({ |
| + plugins: [ |
| + {removeDimensions: false}, |
| + {removeXMLNS: false}, |
| + {cleanupIDs: true} |
| + ] |
| + }) |
| + ])) |
| + .pipe(gulp.dest("./static/dist/img")); |
| +}); |
| + |
| +/****************************************************************************** |
| + * Fonts |
| + ******************************************************************************/ |
| + |
| +gulp.task("fonts", function() { |
| + return gulp.src(["./static/src/fonts/**"]) |
|
ire
2017/12/13 12:15:43
I couldn't find any information on build/optimisat
juliandoucette
2017/12/14 13:01:44
I wonder if this is necessary / how much overhead
ire
2017/12/16 09:59:24
Probably not necessary, just thought to mention it
juliandoucette
2017/12/18 17:11:16
I think we can exclude this then (and add it later
ire
2017/12/20 08:44:20
Do you mean to exclude this whole task? Or to excl
juliandoucette
2018/01/04 15:45:35
Exclude imagemin. Excluding the whole task would m
ire
2018/01/05 07:56:08
Ack. That's what I thought, just confirming. Done.
|
| + .pipe(imagemin([ |
| + imagemin.svgo({ |
| + plugins: [ |
| + {removeDimensions: false}, |
| + {removeXMLNS: false}, |
| + {cleanupIDs: true} |
| + ] |
| + }) |
| + ])) |
| + .pipe(gulp.dest("./static/dist/fonts")); |
| +}); |
| + |
| +/****************************************************************************** |
| * Watch |
| ******************************************************************************/ |
| gulp.task("watch", function() { |
| gulp.watch("./static/src/scss/**/*.scss", ["css"]); |
| gulp.watch("./static/src/js/**/*.js", ["js"]); |
| + gulp.watch("./static/src/img/**", ["img"]); |
| + gulp.watch("./static/src/fonts/**", ["fonts"]); |
| }); |
| /****************************************************************************** |
| * Default |
| ******************************************************************************/ |
| -gulp.task("default", ["css", "js", "watch"]); |
| +gulp.task("default", ["css", "js", "img", "fonts", "watch"]); |