gulp не компелирует css файлы
- что вы делали
Делал все как в уроке
вот мой gulpfiles.js
const gulp = require('gulp');
const browserSync = require('browser-sync');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const autoprefixer = require('gulp-autoprefixer');
const rename = require("gulp-rename");
gulp.task('server', function() {
browserSync({
server: {
baseDir: "src"
}
});
gulp.watch("src/*.html").on('change', browserSync.reload);
});
gulp.task('styles', function() {
return gulp.src("src/sass/**/*.+(scss|sass)")
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(rename({
prefix: '',
suffix: '.min',
}))
.pipe(autoprefixer({
cascade: false
}))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest("src/min.css"))
.pipe(browserSync.stream());
});
gulp.task('watch', function() {
gulp.watch("src/sass/**/*.+(scss|sass)", gulp.parallel('styles'));
})
gulp.task('default', gulp.parallel('watch', 'server', 'styles'));
вот что мне пишет gulp после запуска
PS D:\BEONMAX\runsmart> gulp
[17:01:54] Using gulpfile D:\BEONMAX\runsmart\gulpfile.js
[17:01:54] Starting 'default'...
[17:01:54] Starting 'watch'...
[17:01:54] Starting 'server'...
[17:01:54] Starting 'styles'...
Error in plugin "sass"
Message:
src\sass\blocks\style.scss
Error: File to import not found or unreadable: ../blocks/variables.
on line 1 of src/sass/blocks/style.scss
>> @import '../blocks/variables';
^
[17:01:55] Finished 'styles' after 155 ms
[Browsersync] Access URLs:
---------------------------------------
Local: http://localhost:3000
External: http://192.168.100.21:3000
---------------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
---------------------------------------
[Browsersync] Serving files from: src