【发布时间】:2015-05-04 08:53:48
【问题描述】:
我想使用 Gruntfile 的构建任务,它是 yeoman angular-fullstack 项目的一部分。但是我希望 JS 代码仍然可读,并且还希望避免资产文件名被重命名。
到目前为止,我将 Gruntfile 更改为以下内容:
- 在 useminPrepare 中更改默认流行为
在 gruntfile 中:
useminPrepare: {
html: ['<%= yeoman.client %>/index.html'],
options: {
dest: '<%= yeoman.dist %>/public',
// default flow behavior : https://github.com/yeoman/grunt-usemin#flow
// change the default flow behavior
flow: {
steps: {
js: ['concat'],
css: ['concat']
},
post: {}
}
}
}
- 不要执行 imagemin 或 svgmin
在 gruntfile 中:
concurrent: {
// ...
dist: [
'sass',
// 'imagemin',
// 'svgmin'
]
},
- 更改构建任务
在 gruntfile 中:
grunt.registerTask('build', [
'clean:dist',
'injector:sass',
'concurrent:dist',
'injector',
'wiredep',
'useminPrepare',
'autoprefixer',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
//'cssmin',
//'uglify',
// 'rev',
'usemin'
]);
当我构建我的项目时,我看到了
- js 代码现在全部在 app.js 中,但可读性很好
- 资产/图片丢失
- html 部分缺失。只有 index.html 存在
谁能帮我为 dist 文件夹设置一个构建过程,该文件夹仍然具有正确的图像文件名和 html 和 js 代码仍然可读? 源文件可以放在一个大文件中,但仍应可读。
【问题讨论】:
标签: javascript angularjs yeoman grunt-usemin angular-fullstack