1
我想從我的gulp文件接近我的deploy文件夾,我將gulpfile放在源文件夾中,以便它保持整潔。我現在的文件夾結構:Gulpfile到根目錄的相對路徑
deploy
├── js
├── css
├── img
└── index.php
source
├── node_modules
├── base
├── structure
└── gulpfile.js
上述結構只是滿樹gulpfile.js的
部分的一部分:
var path = {
js: {
src: [
'./source/_base/**/js/*.js',
'./source/_structure/**/js/*.js'
],
deploy: [
'../deploy/js/'
]
},
// more below this line
吞氣任務:
gulp.task('process-js', function(){
gulp.src(path.js.src)
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(concat('main.min.js'))
.pipe(uglify())
.pipe(plumber.stop())
.pipe(gulp.dest(path.js.deploy));
});
當我執行我的gulp任務(使用此部署p ATH)我得到一個錯誤:
:Error: Invalid output folder at Gulp.dest
問:
我如何使用gulpfile相對路徑放置在根文件夾的父文件。
我不知道你傳遞給'gulp.dest()'但它絕對不是'../ deploy/js /''。 –
忘了補充那段代碼,編輯問題 –
好吧,這是你的問題。 'path.js.deploy'是一個數組,而不是一個字符串。 –