修复我的 css/scss 编译后,我现在尝试在我的 html 文件上运行 css,但我不断得到:
GET http://localhost:8080/dist/css/screen.css 404(未找到)localhost/:26
获取http://localhost:8080/source/js/modernizr.js 404(未找到)localhost/:28
现在,我的 html 文件的路径如下:
<link href="dist/css/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<script type"text/javascript" src="source/js/modernizr.js"></script>
我究竟做错了什么?这是一个html路径问题吗?还是 gruntfile.js 问题?html 或 gruntFile.js 中必须缺少某些内容
希望这是有道理的
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
config: {
source: 'source/',
dest: 'dist/',
dist: './dist/'
},
connect: {
options: {
port: 8080,
livereload: 35729,
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: '<%= config.source %>html',
port: 8080
}
},
dist: {
options: {
open: true,
base: '<%= config.dest %>',
livereload: false
}
}
},
watch:{
compass:{
options: {livereload: true },
files:['<%= config.source %>**/*.scss'],
tasks:['compass']
},
css: {
options: {livereload: true },
files: ['<%= config.dest %>*.css'],
tasks: []
},
js: {
options: { livereload: true },
files: ['<%= config.source %>js/*.js'],
tasks: ['jshint']
},
images: {
options: { livereload: true },
files: ['<%= config.source %>images/*.*']
},
fontsicons: {
options: { livereload: true },
files: ['<%= config.source %>images/icons/**/*.{svg,eot,woff,ttf,woff2,otf}']
},
livereload: {
// Here we watch the files the sass task will compile to
// These files are sent to the live reload server after sass compiles to them
options: { livereload: true },
files: ['<%= config.source %>html/*']
}
},
compass: {
dist: {
files: [{
expand: true,
cwd: 'sass',
src: ['source/sass/*.scss', '*.sass'],
dest: 'css/',
ext: '.css'
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['connect:livereload', 'watch', 'compass', ]);
grunt.registerTask('icons', ['webfont']);
};