0
我是Gulp這個令人難以置信的世界的新手。我創建了一個成功讀取/寫入/編譯sass/css/js/html等的gulp文件。但是當我在localhost:1337
上查看網站時,我收到的是「ACCESS DENIED」&「File not found」當加載時localhost:1337/index.html
顯示「ACCESS DENIED」的GULP
下面是吞噬文件(減去依賴關係...)
任何幫助,將不勝感激! :)
更新:我相信我缺少一些配置選項的欣喜若狂,以允許文件加載時,我導航到本地主機:1337/index.html作爲本地主機:1337 /應用程序/ index.html &本地主機:1337/dist/index.html正在瀏覽器中正常加載。
// options
var config = {
html_src: "app/**/*.html",
sass_src: "app/assets/styles/main.scss",
js_src: "app/assets/scripts/**/*.js",
css_dest: "dist/assets/styles",
js_dest: "dist/assets/styles",
js_concat_target: "main.js",
http_port: "1337",
livereload_port: "35729"
};
// end config || begin tasks
gulp.task('styles', function() {
gulp.src(config.sass_src)
.pipe(sass({style:"expanded" }))
.pipe(autoprefixer("last 2 version", "safari 5", "ie 8", "ie 9", "opera 12.1", "ios 6", "android 4"))
.pipe(gulp.dest(config.css_dest))
.pipe(rename({ suffix: ".min" }))
.pipe(minifycss())
.pipe(gulp.dest(config.css_dest))
.pipe(livereload(server))
//.pipe(notify({ message:"styles task complete" }));
});
gulp.task('scripts', function() {
gulp.src(config.js_src)
.pipe(jshint(/* ".jshintrc" */))
.pipe(jshint.reporter('default'))
.pipe(concat(config.js_concat_target))
.pipe(gulp.dest(config.js_dest))
.pipe(rename({ suffix: ".min" }))
.pipe(uglify())
.pipe(gulp.dest(config.js_dest))
.pipe(livereload())
//.pipe(notify({ message: "scripts task complete" }));
});
gulp.task('html', function() {
gulp.src(config.html_src)
.pipe(gulp.dest('dist/'))
.pipe(livereload())
});
gulp.task('clean', function() {
gulp.src([config.css_dest, config.js_dest], { read: false })
.pipe(clean());
});
gulp.task('default', ['clean'], function() {
server.listen(config.livereload_port);
http.createServer(ecstatic({ root: __dirname})).listen(config.http_port);
gutil.log(gutil.colors.yellow('HTTP Server running on port ' + config.http_port));
gulp.watch(config.sass_src, ['styles'])._watcher.on('all', livereload);
gulp.watch(config.js_src, ['scripts'])._watcher.on('all', livereload);
gulp.watch(config.html_src, ['html'])._watcher.on('all', livereload);
});