【发布时间】:2015-10-21 06:00:57
【问题描述】:
使用 Yeoman 创建了一个新的简单 Compass/Bootstrap 项目。 SCSS 文件工作正常,正在编译到 public/css/main.css 中。我可以看到 Gruntfile.js(下)正在监视 compass 文件而不是 js 文件。我只是想让 Grunt 将 Bootstrap.js 编译到 public/js/ 中。 尝试研究和更改文件,但我没有运气。
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: {
app: 'app'
},
connect: {
options: {
port: 9000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
open: true,
base: [
'.tmp',
'<%= config.app %>/public'
]
}
},
},
watch: {
options: {
livereload: true,
},
livereload: {
options: {
livereload: '<%= connect.options.livereload %>'
},
files: [
'<%= config.app %>/public/{,*/}*.html',
'<%= config.app %>/public/css/{,*/}*.css',
'<%= config.app %>/public/images/{,*/}*'
]
},
compass: {
files: ['**/*.{scss,sass}'],
tasks: ['compass:dev']
},
},
compass: {
dev: {
options: {
sassDir: ['app/src/stylesheets'],
cssDir: ['app/public/css'],
environment: 'development'
}
},
prod: {
options: {
sassDir: ['app/src/stylesheets'],
cssDir: ['app/public/css'],
environment: 'production'
}
},
}
});
// Load the plugin
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-connect');
// Additional
grunt.loadNpmTasks('grunt-serve');
// Default task(s).
//grunt.registerTask('default', ['connect:livereload', 'compass:dev', 'watch']);
grunt.registerTask('serve', ['connect:livereload', 'compass:dev', 'watch']);
// prod build
grunt.registerTask('prod', ['compass:prod']);
};
确定这和 Grunt 枪一样简单吗?
【问题讨论】:
标签: twitter-bootstrap gruntjs grunt-contrib-watch