diff --git a/gulpfile.js b/gulpfile.js index e4d1f43..05550f3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,7 @@ let postcss = require('gulp-postcss'); let sass = require('gulp-sass')(require('sass')); let rename = require('gulp-rename') let purgecss = require('gulp-purgecss') +let sourcemaps = require('gulp-sourcemaps'); // PostCSS packages let cssnano = require('cssnano'); let presetEnv = require('postcss-preset-env'); @@ -47,10 +48,12 @@ gulp.task('buildCssDist', buildCssDist); const buildSass = function() { return gulp.src([paths.cssSource + '/*.scss', paths.excludeVendor]) + .pipe(sourcemaps.init()) .pipe(sass().on('error', sass.logError)) .pipe(postcss(postCssProcessors)) + .pipe(sourcemaps.write('')) .pipe(rename({dirname:''})) - .pipe(gulp.dest(paths.cssDest)) + .pipe(gulp.dest(paths.cssDest)); }; gulp.task('buildSass', buildSass); gulp.task('buildsass', buildSass); @@ -61,20 +64,27 @@ const buildSassDist = function() { .pipe(postcss(postCssDistProcessors)) .pipe(purgecss({ content: paths.htmlSource })) .pipe(rename({dirname:''})) - .pipe(gulp.dest(paths.cssDest)) + .pipe(gulp.dest(paths.cssDest)); }; gulp.task('buildSassDist', buildSassDist); gulp.task('buildsassdist', buildSassDist); // Watch -------------------------------------------------------------------- // -const watchCss = function(){ - gulp.watch(paths.cssSource + '/*.css', gulp.series(['buildCss'])) +const watchCss = function() { + gulp.watch(paths.cssSource + '/*.css', gulp.series(['buildCss'])); }; gulp.task('watchCss', watchCss); gulp.task('watchcss', watchCss); -const watchSass = function(){ - gulp.watch(paths.cssSource + '/*.scss', gulp.series(['buildSass'])) +const watchSass = function() { + gulp.watch(paths.cssSource + '/*.scss', gulp.series(['buildSass'])); }; gulp.task('watchSass', watchSass); gulp.task('watchsass', watchSass); + +// Default ------------------------------------------------------------------ // +function defaultTask() { + watchSass(); +} + +exports.default = defaultTask;