Answer the question
In order to leave comments, you need to log in
Gulp not creating css folder when using plugin?
let project_folder = require ("path").basename(__dirname);
let source_folder="#src";
let fs = require('fs');
let path={
build: {
html: project_folder + "/",
css: project_folder + "/css/",
js: project_folder + "/js/",
img: project_folder + "/img/",
fonts: project_folder + "/fonts/",
},
src:{
html: [source_folder + "/*.html", "!" + source_folder + "/_*.html" ],
css: source_folder + "/scss/style.scss",
js: source_folder + "/js/script.js",
img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}",
fonts: source_folder + "/fonts/*.ttf",
},
watch:{
html: source_folder + "/**/*.html",
css: source_folder + "/scss/**/*.scss",
js: source_folder + "/js/**/*.js",
img: source_folder + "/img/**/*.{jpg,png,svg,gif,ico,webp}"
},
clean:"./" + project_folder + "/"
}
let{ src, dest } = require('gulp'),
gulp = require('gulp'),
browsersync = require("browser-sync").create(),
fileinclude = require("gulp-file-include"),
del = require("del"),
scss = require('gulp-sass')(require('sass')),
autoprefixer = require("gulp-autoprefixer"),
group_media = require("gulp-group-css-media-queries"),
clean_css = require("gulp-clean-css"),
rename = require("gulp-rename"),
uglify = require("gulp-uglify-es").default,
svgsprite = require("gulp-svg-sprite"),
ttf2woff = require("gulp-ttf2woff"),
ttf2woff2 = require('gulp-ttf2woff2'); //Шрифты
const imagemin = require('gulp-imagemin');
function browserSync (params) {
browsersync.init({
server:{
baseDir:"./" + project_folder + "/"
},
port: 3000,
notify:false
})
}
function html() {
return src(path.src.html)
.pipe(fileinclude())
.pipe(dest(path.build.html))
.pipe(browsersync.stream())
}
function css() {
return src(path.src.css)
.pipe(
scss({ outputStyle: 'expanded' }).on('error', scss.logError)
)
.pipe(
group_media()
)
.pipe(
autoprefixer({
overrideBrowserslist:["last 5 versions"],
cascade:true
})
)
.pipe(dest(path.build.css))
.pipe(clean_css())
.pipe(
rename({
extname:".min.css"
})
)
.pipe(dest(path.build.css))
.pipe(browsersync.stream())
}
let build = gulp.series(clean, gulp.parallel(js, css, html, images, fonts ),fontsStyle);
let watch = gulp.parallel(build, watchFiles, browserSync);
exports.fontsStyle = fontsStyle;
exports.fonts = fonts;
exports.images = images;
exports.js = js;
exports.css = css;
exports.html = html;
exports.build = build;
exports.watch = watch;
exports.default = watch;
scss = require('gulp-sass')(require('sass'))
.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question