I collect the project with a gulp. The problem with the task for assembling scss-files - the plugin simply changes the resolution of scss to css , the files are not compiled. The paths are spelled correctly, there are no errors in the build process. What could be the reason?

 /* Сама таска */ gulp.task('sass', function () { return gulp.src('./src/sass/**/*.scss') .pipe(plumber()) .pipe(sourcemaps.init()) .pipe(sass.sync().on('error', sass.logError)) .pipe(prefixer()) .pipe(sourcemaps.write('./maps')) .pipe(gulp.dest('dist/style')) .pipe(reload({ stream: true })); }); /* вотчер */ gulp.task('watch', function() { gulp.watch("src/sass/**/*.scss", ['sass']); }); 

Here's what happens: http://ipic.su/img/img7/fs/kiss_8kb.1532001775.png

PS showed only the part of the assembly that relates to the assembly of styles.

  • one
    Your task fulfills correctly. You said that you need to compile all scss, he did it. You have not registered packing in one file. You can simply create something like style.scss and connect your files using @import. And compile only for him - Hikikomori
  • the function of the style.scss that you style.scss by my main.scss - all main.scss files are displayed there. The problem is, the output file should really be one, because I saw the amp version of the site and the plugin that checks the “weight” of styles ( gulp-amp-custom ) refuses to work with a CSS source is not a string. error CSS source is not a string. - Igor
  • one
    Well, compile it only then. Register the src path specifically for it, and not for all scss. PS СSS source is not a string. - probably it wants single-line minified css. I don’t see minification in your task
  • So do, thanks. But still, how to register the compilation of all connected scss-files into a single css? - Igor
  • I did not give the minification and several other tasks in the code, but there is one, thanks for your attention. - Igor

1 answer 1

You can use gulp-concat to build files into one.

 var concat = require('gulp-concat'); ... gulp.task('sass', function () { return gulp.src('./src/sass/**/*.scss') .pipe(plumber()) .pipe(sourcemaps.init()) .pipe(sass.sync().on('error', sass.logError)) .pipe(prefixer()) .pipe(sourcemaps.write('./maps')) .pipe(concat('style.css')) .pipe(gulp.dest('dist/style')) .pipe(reload({ stream: true })); });