| 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'); | 
 |   23  | 
 |   24 /****************************************************************************** | 
 |   25  * CSS | 
 |   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 const entryScssFile = 'main'; | 
|   27     return gulp.src('./static/scss/main.scss') |   35  | 
|   28 »       »       .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', guti
     l.log)) |   36 gulp.task('css', ['css-default', 'css-minified']); | 
|   29 »       »       .pipe(sass().on('error', gutil.log)) |   37  | 
|   30 »       »       .pipe(gulp.dest('./static/css')); |   38 /* Expanded CSS | 
 |   39  ******************************************************************************/ | 
 |   40  | 
 |   41 gulp.task('css-default', function() { | 
 |   42   return gulp.src(`./src/scss/${entryScssFile}.scss`) | 
 |   43     .pipe(sourcemaps.init()) | 
 |   44     .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log)) | 
 |   45     .pipe(sass().on('error', gutil.log)) | 
 |   46     .pipe(sourcemaps.write('./')) | 
 |   47     .pipe(gulp.dest('./static/css')) | 
|   31 }); |   48 }); | 
|   32  |   49  | 
|   33 gulp.task('watch', function() { |   50 /* Minified CSS | 
|   34   gulp.watch('./static/scss/**/*.scss', ['css']); |   51  ******************************************************************************/ | 
 |   52  | 
 |   53 gulp.task('css-minified', function() { | 
 |   54   return gulp.src(`./src/scss/${entryScssFile}.scss`) | 
 |   55     .pipe(sourcemaps.init()) | 
 |   56     .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log)) | 
 |   57     .pipe(sass({outputStyle: 'compressed'}).on('error', gutil.log)) | 
 |   58     .pipe(rename(`${entryScssFile}.min.css`)) | 
 |   59     .pipe(sourcemaps.write('./')) | 
 |   60     .pipe(gulp.dest('./static/css')); | 
|   35 }); |   61 }); | 
|   36  |   62  | 
|   37 gulp.task('default', ['css', 'watch']); |   63 /****************************************************************************** | 
 |   64  * JS | 
 |   65  ******************************************************************************/ | 
 |   66  | 
 |   67 const minify = require('gulp-minify'); | 
 |   68  | 
 |   69 gulp.task('js', function() { | 
 |   70   return gulp.src(['./src/js/*.js']) | 
 |   71     .pipe(sourcemaps.init()) | 
 |   72     .pipe(minify({ | 
 |   73       ext: {src:'.js', min:'.min.js'}, | 
 |   74       preserveComments: 'some' | 
 |   75     })) | 
 |   76     .pipe(sourcemaps.write('./')) | 
 |   77     .pipe(gulp.dest('./static/js')) | 
 |   78 }); | 
 |   79  | 
 |   80 gulp.task('js-vendor', function() { | 
 |   81   return gulp.src(['./src/js/vendor/*.js']) | 
 |   82     .pipe(sourcemaps.init()) | 
 |   83     .pipe(minify({ | 
 |   84       ext: {src:'.js', min:'.min.js'}, | 
 |   85       preserveComments: 'some' | 
 |   86     })) | 
 |   87     .pipe(sourcemaps.write('./')) | 
 |   88     .pipe(gulp.dest('./static/js/vendor')) | 
 |   89 }); | 
 |   90  | 
 |   91 /****************************************************************************** | 
 |   92  * Watch | 
 |   93  ******************************************************************************/ | 
 |   94  | 
 |   95 gulp.task('watch', function() { | 
 |   96   gulp.watch('./src/scss/**/*.scss', ['css']); | 
 |   97   gulp.watch('./src/js/*.js', ['js']); | 
 |   98   gulp.watch('./src/js/vendor/*.js', ['js-vendor']); | 
 |   99 }); | 
 |  100  | 
 |  101 /****************************************************************************** | 
 |  102  * Default | 
 |  103  ******************************************************************************/ | 
 |  104  | 
 |  105 gulp.task('default', ['css', 'js', 'js-vendor', 'watch']); | 
| OLD | NEW |