0
我的文件夾結構包含一個名爲「production」的目錄,其中包含style.css,我正在編寫的文件...我有另一個名爲「css」的目錄,它是我的autoprefixed style.css文件的目標。我設置的手錶任務完美適用於autoprefixer,但minify任務無法通過監視任務在覆蓋新創建的帶有縮小版本的自動補充css時執行。我是新來的吞噬...任何幫助將不勝感激!我該如何獲得一口氣同時觀看autoprefixer和minify?
下面是我在做什麼:
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var cleanCSS = require('gulp-clean-css');
gulp.task('styles',function() {
gulp.src('production/style.css')
.pipe(autoprefixer())
.pipe(gulp.dest('css'))
});
gulp.task('minify-css',function() {
gulp.src('css/style.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('css'));
});
gulp.task('watch',function() {
gulp.watch('production/style.css', ['styles']);
gulp.watch('css/style.css', ['minify-css']);
});
文件結構:
-web-project
-css
-style.css
gulpfile.js
index.html
-node_modules
package.json
-production
-style.css
完美!這工作...謝謝你! – Todd