Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
751 views
in Technique[技术] by (71.8m points)

javascript - How to install gulp-sass-glob

When I am trying to save scss files which are imported to main sccs file - every time I need resave main scss file to apply changes. therefore I have decided to install gulp-sass-glob according to this https://www.npmjs.com/package/gulp-sass-glob but unfortunately it does not work.

Here is my code, please help me how to integrate gulp-sass-glob in my gulp file or what is wrong here. Thank you.

const { src, dest, parallel, series, watch } = require('gulp');

// Load plugins
const sass = require('gulp-sass');
const browsersync = require('browser-sync').create();
const htmlmin = require('gulp-htmlmin');


// Directories
const SRC = './src/';
const DEST = './dist/';
const DEST_CSS = `${DEST}css/`;
const SRC_CSS = `${SRC}scss/*main.scss`;

 
var gulp = require('gulp');
var sassGlob = require('gulp-sass-glob');

gulp.task('styles', function () {
    return gulp
        .src(SRC_CSS)
        .pipe(sassGlob())
        .pipe(sass())
        .pipe(gulp.dest(DEST_CSS));
});

// Watch files
function watchFiles() {
  watch(`${SRC_CSS}*`, css);
  watch(`${SRC}lang`, html);
}
// BrowserSync
function browserSync() {
  browsersync.init({
    server: {
      baseDir: DEST
    },
    port: PORT
  });
}

// Tasks to define the execution of the functions simultaneously or in series
exports.watch = series(
  clear,
  parallel( css, html, copyStaticHTML, watchFiles, browserSync)
);
exports.default = series(clear, parallel(js, css, html,  copyStaticHTML));

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...