Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: gulpfile.js

Issue 29637578: Issue 6182 - Add build step for fonts and images in help.eyeo.com (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Patch Set: Remove imagemin from fonts build step Created Jan. 5, 2018, 7:54 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « .hgignore ('k') | package.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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([
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/**"])
84 .pipe(gulp.dest("./static/dist/fonts"));
85 });
86
87 /******************************************************************************
60 * Watch 88 * Watch
61 ******************************************************************************/ 89 ******************************************************************************/
62 90
63 gulp.task("watch", function() { 91 gulp.task("watch", function() {
64 gulp.watch("./static/src/scss/**/*.scss", ["css"]); 92 gulp.watch("./static/src/scss/**/*.scss", ["css"]);
65 gulp.watch("./static/src/js/**/*.js", ["js"]); 93 gulp.watch("./static/src/js/**/*.js", ["js"]);
94 gulp.watch("./static/src/img/**", ["img"]);
95 gulp.watch("./static/src/fonts/**", ["fonts"]);
66 }); 96 });
67 97
68 /****************************************************************************** 98 /******************************************************************************
69 * Default 99 * Default
70 ******************************************************************************/ 100 ******************************************************************************/
71 101
72 gulp.task("default", ["css", "js", "watch"]); 102 gulp.task("default", ["css", "js", "img", "fonts", "watch"]);
OLDNEW
« no previous file with comments | « .hgignore ('k') | package.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld