gulp 針對某目錄下的所有檔案處理後,如果要能根據目錄結構輸出到另一個目錄,記得要指定 {‘base’: 來源根目錄}:
https://github.com/gulpjs/gulp/blob/master/docs/API.md#optionsbase
// without the 'base' set
gulp.src('app/**/*.scss') // file: 'app/css/somefile.scss'
.pipe(gulp.dest('build')); //-> file base: 'app/css'
// relative path: 'somefile.scss'
// write path: 'build/somefile.scss'
// with the 'base' set
var glob = 'app/**/*.scss';
gulp.src(glob, { base: 'app' }) // file: 'app/css/somefile.scss'
.pipe(gulp.dest('build')); //-> file base: 'app'
// relative path: 'css/somefile.scss'
// write path: 'build/css/somefile.scss'
0 意見:
張貼留言