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

Delta Between Two Patch Sets: gulpfile.js

Issue 29624561: Issue 6104 - Minified code in help center repository (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Left Patch Set: Created Nov. 29, 2017, 2:25 p.m.
Right Patch Set: Consolidated gulp tasks Created Dec. 7, 2017, 2:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « globals/get_inline_bg.py ('k') | includes/layout/header.tmpl » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*! 1 /*!
juliandoucette 2017/11/29 23:30:36 Tabs! :O
ire 2017/11/30 10:04:43 Oops :O ! Fixed :)
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
24 /**************************************************************************
25 * CSS
juliandoucette 2017/11/29 23:30:36 There seems to be something wrong with the SCSS so
ire 2017/11/30 10:04:43 Fixed. It was because I was calling sourcemaps.wri
26 **************************************************************************/
27
28 const sass = require('gulp-sass'); 23 const sass = require('gulp-sass');
29 const postcss = require('gulp-postcss'); 24 const postcss = require('gulp-postcss');
30 const scss = require('postcss-scss'); 25 const scss = require('postcss-scss');
31 const autoprefixer = require('autoprefixer'); 26 const autoprefixer = require('autoprefixer');
32 const cleanCSS = require('gulp-clean-css'); 27 const minify = require('gulp-minify');
28
29 /******************************************************************************
30 * CSS
31 ******************************************************************************/
33 32
34 gulp.task('css', function() { 33 gulp.task('css', function() {
juliandoucette 2017/12/08 14:57:21 Single quotes :( ... (I love single quotes... I w
ire 2017/12/11 15:29:31 Done.
35 » return gulp.src('./src/scss/main.scss') 34 return gulp.src(`./static/src/scss/main.scss`)
juliandoucette 2017/12/08 14:57:17 Backtics...
ire 2017/12/11 15:29:32 Done.
36 » » .pipe(sourcemaps.init()) 35 .pipe(sourcemaps.init())
37 » » .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', guti l.log)) 36 .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log))
38 » » .pipe(sass().on('error', gutil.log)) 37 .pipe(sass({outputStyle: 'compressed'}).on('error', gutil.log))
39 » » .pipe(sourcemaps.write('./')) 38 .pipe(rename(`main.min.css`))
40 » » .pipe(gulp.dest('./static/css')) 39 .pipe(sourcemaps.write('./'))
41 » » .pipe(cleanCSS()) 40 .pipe(gulp.dest('./static/dist/css'));
42 » » .pipe(rename('main.min.css'))
43 » » .pipe(sourcemaps.write('./'))
44 » » .pipe(gulp.dest('./static/css'));
45 }); 41 });
46 42
47 /************************************************************************** 43 /******************************************************************************
48 * JS 44 * JS
49 **************************************************************************/ 45 ******************************************************************************/
50
51 const minify = require('gulp-minify');
juliandoucette 2017/11/29 23:30:36 Requires usually go at the top
ire 2017/11/30 10:04:43 Is that a coding style thing? I thought it made se
juliandoucette 2017/12/04 10:49:37 "<kzar> julian: Yea. It's certainly a convention t
52 46
53 gulp.task('js', function() { 47 gulp.task('js', function() {
54 » return gulp.src(['./src/js/*.js']) 48 return gulp.src(['./static/src/js/**/*.js'])
55 » » .pipe(sourcemaps.init()) 49 .pipe(sourcemaps.init())
56 » » .pipe(minify({ 50 .pipe(minify({
57 » » » ext: {src:'.js', min:'.min.js'}, 51 noSource: true,
58 » » » preserveComments: 'some' 52 ext: {src:'.js', min:'.min.js'},
juliandoucette 2017/12/08 14:57:17 Maybe src:js is unnecessary?
ire 2017/12/11 15:29:31 Done.
59 » » })) 53 preserveComments: 'some'
60 » » .pipe(sourcemaps.write('./')) 54 }))
61 » » .pipe(gulp.dest('./static/js')) 55 .pipe(sourcemaps.write('./'))
56 .pipe(gulp.dest('./static/dist/js'))
62 }); 57 });
63 58
64 gulp.task('js-vendor', function() { 59 /******************************************************************************
65 » return gulp.src(['./src/js/vendor/*.js']) 60 * Watch
66 » » .pipe(sourcemaps.init()) 61 ******************************************************************************/
67 » » .pipe(minify({ 62
68 » » » ext: {src:'.js', min:'.min.js'}, 63 gulp.task('watch', function() {
69 » » » preserveComments: 'some' 64 gulp.watch('./static/src/scss/**/*.scss', ['css']);
70 » » })) 65 gulp.watch('./static/src/js/**/*.js', ['js']);
71 » » .pipe(sourcemaps.write('./'))
72 » » .pipe(gulp.dest('./static/js/vendor'))
73 }); 66 });
74 67
75 /************************************************************************** 68 /******************************************************************************
76 * Watch 69 * Default
77 **************************************************************************/ 70 ******************************************************************************/
78 71
79 gulp.task('watch', function() { 72 gulp.task('default', ['css', 'js', 'watch']);
80 » gulp.watch('./src/scss/**/*.scss', ['css']);
81 » gulp.watch('./src/js/*.js', ['js']);
82 » gulp.watch('./src/js/vendor/*.js', ['js-vendor']);
83 });
84
85 /**************************************************************************
86 * Default
87 **************************************************************************/
88
89 gulp.task('default', ['css', 'js', 'js-vendor', 'watch']);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld