Grunt usemin with templates
- by gang
Given the following directory structure:
– Gruntfile.js
– app
|– index.php
|– js
|– css
|– templates
|– template.php
– dist
How can I configure grunt usemin to update the references to styles and scripts in my template file relative to the index.php which uses the template?
currently the tasks look like this:
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 %>']
}
}
And the blocks inside of the template look like this:
<!-- build:js js/main.js -->
<script src="js/script1.js"></script>
<script src="js/script2.js"></script>
<!-- endbuild -->