Left: | ||
Right: |
OLD | NEW |
---|---|
1 /*! | 1 /*! |
2 * This file is part of help.eyeo.com. | 2 * This file is part of help.eyeo.com. |
3 * Copyright (C) 2017-present eyeo GmbH | 3 * Copyright (C) 2017-present eyeo GmbH |
4 * | 4 * |
5 * help.eyeo.com is free software: you can redistribute it and/or modify | 5 * help.eyeo.com is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License as published by | 6 * it under the terms of the GNU General Public License as published by |
7 * the Free Software Foundation, either version 3 of the License, or | 7 * the Free Software Foundation, either version 3 of the License, or |
8 * (at your option) any later version. | 8 * (at your option) any later version. |
9 * | 9 * |
10 * help.eyeo.com is distributed in the hope that it will be useful, | 10 * help.eyeo.com is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 * GNU General Public License for more details. | 13 * GNU General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU General Public License | 15 * You should have received a copy of the GNU General Public License |
16 * along with help.eyeo.com. If not, see <http://www.gnu.org/licenses/>. | 16 * along with help.eyeo.com. If not, see <http://www.gnu.org/licenses/>. |
17 */ | 17 */ |
18 | 18 |
19 const gulp = require("gulp"); | 19 const gulp = require("gulp"); |
20 const gutil = require("gulp-util"); | 20 const gutil = require("gulp-util"); |
21 const sourcemaps = require("gulp-sourcemaps"); | 21 const sourcemaps = require("gulp-sourcemaps"); |
22 const rename = require("gulp-rename"); | 22 const rename = require("gulp-rename"); |
23 const sass = require("gulp-sass"); | 23 const sass = require("gulp-sass"); |
24 const postcss = require("gulp-postcss"); | 24 const postcss = require("gulp-postcss"); |
25 const scss = require("postcss-scss"); | 25 const scss = require("postcss-scss"); |
26 const autoprefixer = require("autoprefixer"); | 26 const autoprefixer = require("autoprefixer"); |
27 const minify = require("gulp-minify"); | 27 const minify = require("gulp-minify"); |
28 const imagemin = require('gulp-imagemin'); | |
28 | 29 |
29 /****************************************************************************** | 30 /****************************************************************************** |
30 * CSS | 31 * CSS |
31 ******************************************************************************/ | 32 ******************************************************************************/ |
32 | 33 |
33 gulp.task("css", function() { | 34 gulp.task("css", function() { |
34 return gulp.src("./static/src/scss/main.scss") | 35 return gulp.src("./static/src/scss/main.scss") |
35 .pipe(sourcemaps.init()) | 36 .pipe(sourcemaps.init()) |
36 .pipe(postcss([autoprefixer()], {syntax: scss}).on("error", gutil.log)) | 37 .pipe(postcss([autoprefixer()], {syntax: scss}).on("error", gutil.log)) |
37 .pipe(sass({outputStyle: "compressed"}).on("error", gutil.log)) | 38 .pipe(sass({outputStyle: "compressed"}).on("error", gutil.log)) |
(...skipping 12 matching lines...) Expand all Loading... | |
50 .pipe(minify({ | 51 .pipe(minify({ |
51 noSource: true, | 52 noSource: true, |
52 ext: {min:".min.js"}, | 53 ext: {min:".min.js"}, |
53 preserveComments: "some" | 54 preserveComments: "some" |
54 })) | 55 })) |
55 .pipe(sourcemaps.write("./")) | 56 .pipe(sourcemaps.write("./")) |
56 .pipe(gulp.dest("./static/dist/js")) | 57 .pipe(gulp.dest("./static/dist/js")) |
57 }); | 58 }); |
58 | 59 |
59 /****************************************************************************** | 60 /****************************************************************************** |
61 * Images | |
62 ******************************************************************************/ | |
63 | |
64 gulp.task("img", function() { | |
65 return gulp.src(["./static/src/img/**"]) | |
66 .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
| |
67 imagemin.svgo({ | |
68 plugins: [ | |
69 {removeDimensions: false}, | |
70 {removeXMLNS: false}, | |
71 {cleanupIDs: true} | |
72 ] | |
73 }) | |
74 ])) | |
75 .pipe(gulp.dest("./static/dist/img")); | |
76 }); | |
77 | |
78 /****************************************************************************** | |
79 * Fonts | |
80 ******************************************************************************/ | |
81 | |
82 gulp.task("fonts", function() { | |
83 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.
| |
84 .pipe(imagemin([ | |
85 imagemin.svgo({ | |
86 plugins: [ | |
87 {removeDimensions: false}, | |
88 {removeXMLNS: false}, | |
89 {cleanupIDs: true} | |
90 ] | |
91 }) | |
92 ])) | |
93 .pipe(gulp.dest("./static/dist/fonts")); | |
94 }); | |
95 | |
96 /****************************************************************************** | |
60 * Watch | 97 * Watch |
61 ******************************************************************************/ | 98 ******************************************************************************/ |
62 | 99 |
63 gulp.task("watch", function() { | 100 gulp.task("watch", function() { |
64 gulp.watch("./static/src/scss/**/*.scss", ["css"]); | 101 gulp.watch("./static/src/scss/**/*.scss", ["css"]); |
65 gulp.watch("./static/src/js/**/*.js", ["js"]); | 102 gulp.watch("./static/src/js/**/*.js", ["js"]); |
103 gulp.watch("./static/src/img/**", ["img"]); | |
104 gulp.watch("./static/src/fonts/**", ["fonts"]); | |
66 }); | 105 }); |
67 | 106 |
68 /****************************************************************************** | 107 /****************************************************************************** |
69 * Default | 108 * Default |
70 ******************************************************************************/ | 109 ******************************************************************************/ |
71 | 110 |
72 gulp.task("default", ["css", "js", "watch"]); | 111 gulp.task("default", ["css", "js", "img", "fonts", "watch"]); |
OLD | NEW |