usemin ignores searchpath or "doesn't rev nested directories" or "can't set absolute root search path"
imagine you have this file tree :
_gh_pages/
index.html
something.html
about/
index.html
another/
index.html
assets/
css/
lots-of-revved-stuff-here
js
also-revved-here-too-wow
I run useminprepare, concat, uglify, cssmin, filerev, usemin and only the root level html files in _gh_pages have their asset references changed to the revved files. nested html files are ignored, despite me indicating a subdirectory wildcard pattern.
https://gist.github.com/airtonix/8396336
Please advise.
I've even tried installing usemin from git :
npm install https://github.com/yeoman/grunt-usemin.git#master
"devDependencies": {
"matchdep": "~0.3.0",
"assemble": "~0.4.33",
"assemble-swig": "~0.1.0",
"grunt": "~0.4.1",
"grunt-usemin": "~2.0.2",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-watch": "~0.4.3",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-cssmin": "~0.7.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-imagemin": "~0.4.1",
"grunt-contrib-less": "~0.9.0",
"grunt-filerev": "~0.2.0",
},
"engines": {
"node": ">=0.10.0"
}
Similar issue here, also not working in a subdir. Files being renamed and map being created in grunt.filerev.summary, but usemin does not replace the references to the files. References are scattered throughout css and js files, but usemin touches them all. Unclear how this is supposed to work, wish usemin had some output about how it is/isn't responding to the map object.
Having the same issue. I think it may be because usemin is ignoring the "root" option in useminPrepare. My gruntfile:
useminPrepare: {
html: ['alpha/includes/top.php'],
options: {
root: 'alpha',
dest: 'dist'
}
}
usemin: {
html: ['dist/includes/top_new.php'],
css: ['dist/css/*.css'],
options: {
dirs: ['dist']
}
},
grunt.registerTask('build', ['copy:dist', 'useminPrepare', 'concat', 'cssmin', 'uglify', 'rev', 'usemin']);
Here is my html file:
<!-- build:js(alpha) /js/home.min.js -->
<script src="/js/navbar.js"></script>
<script src="/js/home.js"></script>
<!-- endbuild -->
Here is my file structure created. rev makes the file correctly. I can also use filerev and it works correctly as well.
dist
js
9925c035.home.min.js
Here is the debug output from usemin:
fileprocessor Let's replace /js/home.min.js +0ms
fileprocessor Looking for revved version of /js/home.min.js in +0ms [ 'dist/includes' ]
revvedfinder Looking for revved version of /js/home.min.js in +0ms [ 'dist/includes' ]
revvedfinder Looking on disk +0ms
revvedfinder Looking for dist/includes/js/home.min.*.js and dist/includes/js/*.home.min.js on disk +0ms
revvedfinder Found +1ms []
revvedfinder filepath is now +0ms undefined
fileprocessor Found file '/js/home.min.js' +0ms
You can see that usemin never looks in dist/js/ for the reved file
May be related to https://github.com/yeoman/grunt-usemin/issues/304