假设有如下目录结构:
– Gruntfile.js
– app
|– index.php
|– js
|– css
|– templates
|– template.php
– dist
我该如何配置grunt usemin以更新我的模板文件中与使用模板的index.php相对应的样式和脚本引用?
当前任务看起来像这样:
useminPrepare: {
html: '<%= yeoman.app %>/templates/template.php',
options: {
dest: '<%= yeoman.dist %>'
}
},
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.php'],
css: ['<%= yeoman.dist %>/css/*.css'],
options: {
dirs: ['<%= yeoman.dist %>']
}
}
模板内部的块看起来像这样:
<!-- build:js js/main.js -->
<script src="js/script1.js"></script>
<script src="js/script2.js"></script>
<!-- endbuild -->