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'); | |
22 const rename = require('gulp-rename'); | |
21 const sass = require('gulp-sass'); | 23 const sass = require('gulp-sass'); |
22 const postcss = require('gulp-postcss'); | 24 const postcss = require('gulp-postcss'); |
23 const scss = require('postcss-scss'); | 25 const scss = require('postcss-scss'); |
24 const autoprefixer = require('autoprefixer'); | 26 const autoprefixer = require('autoprefixer'); |
27 const minify = require('gulp-minify'); | |
28 | |
29 /****************************************************************************** | |
30 * CSS | |
31 ******************************************************************************/ | |
25 | 32 |
26 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.
| |
27 return gulp.src('./static/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.
| |
28 » » .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', guti l.log)) | 35 .pipe(sourcemaps.init()) |
29 » » .pipe(sass().on('error', gutil.log)) | 36 .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log)) |
30 » » .pipe(gulp.dest('./static/css')); | 37 .pipe(sass({outputStyle: 'compressed'}).on('error', gutil.log)) |
38 .pipe(rename(`main.min.css`)) | |
39 .pipe(sourcemaps.write('./')) | |
40 .pipe(gulp.dest('./static/dist/css')); | |
31 }); | 41 }); |
32 | 42 |
33 gulp.task('watch', function() { | 43 /****************************************************************************** |
34 gulp.watch('./static/scss/**/*.scss', ['css']); | 44 * JS |
45 ******************************************************************************/ | |
46 | |
47 gulp.task('js', function() { | |
48 return gulp.src(['./static/src/js/**/*.js']) | |
49 .pipe(sourcemaps.init()) | |
50 .pipe(minify({ | |
51 noSource: true, | |
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.
| |
53 preserveComments: 'some' | |
54 })) | |
55 .pipe(sourcemaps.write('./')) | |
56 .pipe(gulp.dest('./static/dist/js')) | |
35 }); | 57 }); |
36 | 58 |
37 gulp.task('default', ['css', 'watch']); | 59 /****************************************************************************** |
60 * Watch | |
61 ******************************************************************************/ | |
62 | |
63 gulp.task('watch', function() { | |
64 gulp.watch('./static/src/scss/**/*.scss', ['css']); | |
65 gulp.watch('./static/src/js/**/*.js', ['js']); | |
66 }); | |
67 | |
68 /****************************************************************************** | |
69 * Default | |
70 ******************************************************************************/ | |
71 | |
72 gulp.task('default', ['css', 'js', 'watch']); | |
OLD | NEW |