D
D
DeniSidorenko2017-08-09 16:08:09
Sass
DeniSidorenko, 2017-08-09 16:08:09

How to compile all sass files into one css?

Hello, there is such a GULP SASS task./

gulp.task('sass', function() {
  return gulp.src('app/sass/**/*.sass')
  .pipe(sass({outputStyle: 'expand'}).on("error", notify.onError()))
  .pipe(rename({suffix: '.min', prefix : ''}))
  .pipe(autoprefixer(['last 15 versions']))
  .pipe(cleanCSS()) // Опционально, закомментировать при отладке
  .pipe(gulp.dest('app/css'))
  .pipe(browserSync.reload({stream: true}));
});

And there is one main.sass file that compiles to main.css. I created a couple more sass files to divide the code into blocks and @importput it in main.sass, but other css files are created along with it. 1 sass file = 1 css file

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2017-08-09
@alexey-m-ukolov

Created a couple more sass files to separate the code into blocks
The names of these files must start with _. For example, _foo.scss.
If you have a SCSS or Sass file that you want to import but don't want to compile to a CSS file, you can add an underscore to the beginning of the filename. This will tell Sass not to compile it to a normal CSS file. You can then import these files without using the underscore.
For example, you might have _colors.scss. Then no _colors.css file would be created, and you can do
and _colors.scss would be imported.

sass-lang.com/documentation/file.SASS_REFERENCE.ht...

A
abberati, 2017-08-09
@abberati

it is enough to tell gulp in the second line of the task that it should not take all the files from everywhere, but one root main.sass, into which the rest are connected
return gulp.src('app/sass/path/to/main.sass')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question