给定以下目录结构:
– 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 -->