//gulpfile
const gulp = require("gulp"),
browserSync = require("browser-sync").create(),
ScssTask = require('./gulp/tasks/scss'),
...
gulp.task('production-build:scss', ScssTask.prodScss()); //Таск для продакшен-сборки, browserSync передавать уже не нужно
//scss.js
const gulp = require("gulp"),
...
const prodScss = () => { // Ничего не передаётся
return gulp.src(config.srcPath + config.scss + '/main.scss')
.pipe(sass())
.pipe(autoprefixer({
browsers: ["last 15 versions"],
cascade: true
}))
.pipe(gcmq())
.pipe(cleanCSS({compatibility: "ie8"}))
.pipe(gulp.dest(config.prodPath + config.css));
};
module.exports = {
prodScss,
devScss
}
Task production-build:scss can't support dependencies that is not an array of strings
//gulpfile.js
const gulp = require("gulp"),
browserSync = require("browser-sync").create(),
createScssTask = require('./gulp/tasks/scss'),
requireDir = require('require-dir');
requireDir('./gulp', {recurse: true});
gulp.task("default", ["serve", "dev:js", "dev:scss", "dev:nunjucks", "dev:font"]);
gulp.task('dev:scss', createScssTask.devScss(browserSync));
//scss.js
const gulp = require("gulp"),
sourcemaps = require("gulp-sourcemaps"),
cleanCSS = require("gulp-clean-css"),
gcmq = require("gulp-group-css-media-queries"),
autoprefixer = require("gulp-autoprefixer"),
sass = require("gulp-sass"),
plumber = require("gulp-plumber"),
config = require("../config");
const devScss = (browserSync) => {
return gulp.src(config.srcPath + config.scss + '/main.scss')
.pipe(sourcemaps.init())
.pipe(plumber())
.pipe(sass().on("error", sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest(config.devPath + config.css))
.pipe(browserSync.stream());
}
const prodScss = () => {
return gulp.src(config.srcPath + config.scss + '/main.scss')
.pipe(sass())
.pipe(autoprefixer({
browsers: ["last 15 versions"],
cascade: true
}))
.pipe(gcmq())
.pipe(cleanCSS({compatibility: "ie8"}))
.pipe(gulp.dest(config.prodPath + config.css));
}
module.exports = {
devScss,
prodScss,
}
Error: Task dev:scss can't support dependencies that is not an array of strings