How to use Gulp to auto copy source files when compiling scss?

Asked

Viewed 33 times

1

I’m using Gulp with Gulp-Sass to build my css files. I would like to build the SCSS source files referenced by @font-face within the style be automatically copied to Assets/fonts, while the css would be generated in Assets/css. Currently I build the scss 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'));
});

Already the file scss/style.scss contains the content:

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

It would be a similar idea to the 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
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.