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

Side by Side Diff: gulpfile.js

Issue 29624561: Issue 6104 - Minified code in help center repository (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Patch Set: Created Nov. 29, 2017, 2:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« .gitignore ('K') | « .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 /*!
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');
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
21 const sass = require('gulp-sass'); 28 const sass = require('gulp-sass');
22 const postcss = require('gulp-postcss'); 29 const postcss = require('gulp-postcss');
23 const scss = require('postcss-scss'); 30 const scss = require('postcss-scss');
24 const autoprefixer = require('autoprefixer'); 31 const autoprefixer = require('autoprefixer');
32 const cleanCSS = require('gulp-clean-css');
25 33
26 gulp.task('css', function() { 34 gulp.task('css', function() {
27 return gulp.src('./static/scss/main.scss') 35 » return gulp.src('./src/scss/main.scss')
36 » » .pipe(sourcemaps.init())
28 .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', guti l.log)) 37 .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', guti l.log))
29 .pipe(sass().on('error', gutil.log)) 38 .pipe(sass().on('error', gutil.log))
39 .pipe(sourcemaps.write('./'))
40 .pipe(gulp.dest('./static/css'))
41 .pipe(cleanCSS())
42 .pipe(rename('main.min.css'))
43 .pipe(sourcemaps.write('./'))
30 .pipe(gulp.dest('./static/css')); 44 .pipe(gulp.dest('./static/css'));
31 }); 45 });
32 46
33 gulp.task('watch', function() { 47 /**************************************************************************
34 gulp.watch('./static/scss/**/*.scss', ['css']); 48 * JS
49 **************************************************************************/
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
53 gulp.task('js', function() {
54 » return gulp.src(['./src/js/*.js'])
55 » » .pipe(sourcemaps.init())
56 » » .pipe(minify({
57 » » » ext: {src:'.js', min:'.min.js'},
58 » » » preserveComments: 'some'
59 » » }))
60 » » .pipe(sourcemaps.write('./'))
61 » » .pipe(gulp.dest('./static/js'))
35 }); 62 });
36 63
37 gulp.task('default', ['css', 'watch']); 64 gulp.task('js-vendor', function() {
65 » return gulp.src(['./src/js/vendor/*.js'])
66 » » .pipe(sourcemaps.init())
67 » » .pipe(minify({
68 » » » ext: {src:'.js', min:'.min.js'},
69 » » » preserveComments: 'some'
70 » » }))
71 » » .pipe(sourcemaps.write('./'))
72 » » .pipe(gulp.dest('./static/js/vendor'))
73 });
74
75 /**************************************************************************
76 * Watch
77 **************************************************************************/
78
79 gulp.task('watch', function() {
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']);
OLDNEW
« .gitignore ('K') | « .hgignore ('k') | package.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld