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([ |
+ 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/**"]) |
+ .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"]); |