Answer the question
In order to leave comments, you need to log in
Is it possible to create a task in gallp...?
Guys, help me through the gallp to create a task so that the sass file is compiled into the usual style.css and then immediately into the minified min.style.css (that is, it turns out you need 3 files: style.sass, style.css and min.style.css )? When changing the sass file, there were changes in the css and min.css, and when the css was changed, there were changes in the min.css (minify using the plugin in the clean CSS galle).
Answer the question
In order to leave comments, you need to log in
Styles
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');
const csso = require('gulp-csso');
const config = require('../config.js').styles;
gulp.task('styles', () => {
return gulp.src(config.entry, {cwd: config.srcDir})
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.distDir))
.pipe(csso()))
.pipe(rename({
extname: 'min'
}))
.pipe(gulp.dest(config.distDir));
});
});
const gulp = require('gulp');
const config = require('../config.js');
gulp.task('watch', () => {
gulp.watch(`${config.path.styles}**/*.sass`, ['styles']);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question