| Index: gulpfile.js |
| =================================================================== |
| --- a/gulpfile.js |
| +++ b/gulpfile.js |
| @@ -13,25 +13,77 @@ |
| * GNU General Public License for more details. |
| * |
| * You should have received a copy of the GNU General Public License |
| * along with help.eyeo.com. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| const gulp = require('gulp'); |
| const gutil = require('gulp-util'); |
| +const sourcemaps = require('gulp-sourcemaps'); |
| +const rename = require('gulp-rename'); |
| + |
| +/************************************************************************** |
| + * 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
|
| + **************************************************************************/ |
| + |
| const sass = require('gulp-sass'); |
| const postcss = require('gulp-postcss'); |
| const scss = require('postcss-scss'); |
| const autoprefixer = require('autoprefixer'); |
| +const cleanCSS = require('gulp-clean-css'); |
| gulp.task('css', function() { |
| - return gulp.src('./static/scss/main.scss') |
| + return gulp.src('./src/scss/main.scss') |
| + .pipe(sourcemaps.init()) |
| .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log)) |
| .pipe(sass().on('error', gutil.log)) |
| + .pipe(sourcemaps.write('./')) |
| + .pipe(gulp.dest('./static/css')) |
| + .pipe(cleanCSS()) |
| + .pipe(rename('main.min.css')) |
| + .pipe(sourcemaps.write('./')) |
| .pipe(gulp.dest('./static/css')); |
| }); |
| -gulp.task('watch', function() { |
| - gulp.watch('./static/scss/**/*.scss', ['css']); |
| +/************************************************************************** |
| + * JS |
| + **************************************************************************/ |
| + |
| +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
|
| + |
| +gulp.task('js', function() { |
| + return gulp.src(['./src/js/*.js']) |
| + .pipe(sourcemaps.init()) |
| + .pipe(minify({ |
| + ext: {src:'.js', min:'.min.js'}, |
| + preserveComments: 'some' |
| + })) |
| + .pipe(sourcemaps.write('./')) |
| + .pipe(gulp.dest('./static/js')) |
| }); |
| -gulp.task('default', ['css', 'watch']); |
| +gulp.task('js-vendor', function() { |
| + return gulp.src(['./src/js/vendor/*.js']) |
| + .pipe(sourcemaps.init()) |
| + .pipe(minify({ |
| + ext: {src:'.js', min:'.min.js'}, |
| + preserveComments: 'some' |
| + })) |
| + .pipe(sourcemaps.write('./')) |
| + .pipe(gulp.dest('./static/js/vendor')) |
| +}); |
| + |
| +/************************************************************************** |
| + * Watch |
| + **************************************************************************/ |
| + |
| +gulp.task('watch', function() { |
| + gulp.watch('./src/scss/**/*.scss', ['css']); |
| + gulp.watch('./src/js/*.js', ['js']); |
| + gulp.watch('./src/js/vendor/*.js', ['js-vendor']); |
| +}); |
| + |
| +/************************************************************************** |
| + * Default |
| + **************************************************************************/ |
| + |
| +gulp.task('default', ['css', 'js', 'js-vendor', 'watch']); |