How to use gulp to auto copy source files while compiling scss?

1

I'm using gulp with gulp-sass to generate the build of my css files. I would like to do in SCSS build, source files referenced by @ font-face within the style would be automatically copied to assets / fonts , whereas css would be generated in assets / css . I currently do the scss build with the task below:

gulp.task('scss', function () {
    return gulp.src('scss/estilo.scss')
            .pipe(sass({outputStyle: 'expanded'}).on('error', sass.logError))
            .pipe(rename({ suffix: '.min' }))
            .pipe(gulp.dest('assets/css'));
});

The scss / style.scss file contains the content:

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

It would be an idea similar to that of Laravel-mix, which reads the scss or sass file and copies the files referenced by url ()

I use the gulp version:

  • CLI version 1.4.0
  • Local version 3.9.1
asked by anonymous 23.11.2017 / 13:50

0 answers