Gulp Sass - How to properly name the output css?

前端 未结 1 1928
你的背包
你的背包 2021-02-05 03:48

I\'m reading a tutorial about sass here then I tried some other approach and I cant get the answer in this tutorial. Theres the problem. I have this code in my gulpfile.js

相关标签:
1条回答
  • 2021-02-05 04:23

    gulp-sass doesn't take any file name parameters. Use gulp-rename to rename your files. If you have more than one .navbar.scss files you want to concatenate into one navbar.css files, feel free to use gulp-concat. This one takes a file name parameter :-)

    Install gulp-rename with npm install gulp-rename --save-dev

    var rename = require('gulp-rename');
    
    return gulp.src('assets/css/sass/**/*/*.navbar.scss')
       .pipe(sass())
       .pipe(rename('navbar.css'))
       .pipe(gulp.dest('assets/css');
    

    or

    Install gulp-concat with npm install gulp-concat --save-dev

    var concat = require('gulp-concat');
    
    return gulp.src('assets/css/sass/**/*/*.navbar.scss')
       .pipe(sass())
       .pipe(concat('navbar.css'))
       .pipe(gulp.dest('assets/css');
    
    0 讨论(0)
提交回复
热议问题