我正在使用gulp.The任务正在运行创建所需的文件夹。但是我在浏览器中运行时得不到GET /错误。我附上了我的项目结构的图像以及命令行中的输出。 。我的index.html包含以下不能上http:// localhost:3000/
<!DOCTYPE html>
<html lang="en" ng-app="helloWorldApp">
<head>
<title>Angular hello world app</title>
<link href="css/main.css" rel="stylesheet">
</head>
<body>
<ng-view class="view"></ng-view>
</body>
<script src="js/scripts.js"></script>
</html>
我想知道为什么它不能获取或不正确的路由和应该做什么。所以,问题是当服务器在本地主机上运行和我打本地主机:3000 /浏览器,它说不能用白色background.Following得到的是我的gulpfile.js
const gulp = require('gulp');
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();
const scripts = require('./scripts');
const styles = require('./styles');
var devMode = false;
gulp.task('css',function(){
gulp.src(styles)
.pipe(concat('main.css'))
.pipe(gulp.dest('./dist/css'))
.pipe(browserSync.reload({
stream : true
}))
});
gulp.task('js',function(){
gulp.src(scripts)
.pipe(concat('scripts.js'))
.pipe(gulp.dest('./dist/js'))
.pipe(browserSync.reload({
stream : true
}))
});
gulp.task('html',function(){
gulp.src('./templates/**/*.html')
.pipe(gulp.dest('./dist/html'))
.pipe(browserSync.reload({
stream : true
}))
});
gulp.task('build',function(){
gulp.start(['css','js','html']);
console.log("finshed build");
});
gulp.task('browser-sync',function(){
browserSync.init(null,{
open : false,
server : {
baseDir : 'dist'
}
});
console.log("finshed browser ");
});
gulp.task('start',function(){
devMode = true;
gulp.start(['build','browser-sync']);
gulp.watch(['./css/**/*.css'],['css']);
gulp.watch(['./js/**/*.js'],['js']);
gulp.watch(['./templates/**/*.html'],['html']);
});
我很抱歉,但您的问题不够清楚,我们无法理解您的问题是什么!你的错误是什么?它是什么时候发生的?你期望发生什么? – Hampus
为什么您将null作为第一个参数传递给浏览器同步以及什么是open:false应该这样做? – Hampus
open:false是为了避免在没有请求的情况下直接打开选项卡。并且不需要null。 – FalconFlyer