Given the following file app.js
$stateProvider
.state('intro', {
url: '/intro',
templateUrl: 'partials/intro.html',
controller: 'IntroController as IntroCtrl'
})
.state('search', {
url: '/search',
templateUrl: 'partials/search.html',
controller: 'SearchController as searchCtrl'
})
;
The task is to change the templateUrl files to their revisioned counterparts which were revisioned with grunt filerev.
I have a usemin target with grunt
useminPrepare: {// configuration which tasks usemin will change/run
html: build_src + '/index.html',
options: {
dest: build_dest + '',
}
},
usemin: {
html: [build_dest + '/index.html'],
options: {
dirs: [build_dest + '', build_dest + '/dist']
}
}
It is documented how to insert block comments in html and then usemin performs the revisioning and also the replacement of revisioned files.
How it is achieved for the javascript file?
I continued to search after the answer of cetia
I found the solution at: https://github.com/yeoman/grunt-usemin/issues/235#issuecomment-33316221
usemin: {
html: [build_dest + '/index.html'],
js:[build_dest + '/**/*.js'],
options: {
dirs:[build_dest, build_dest + '/dist'],
assetsDirs: [build_dest],
patterns: {
// FIXME While usemin won't have full support for revved files we have to put all references manually here
js: [
[/(partials\/.*?\.html)/gm, 'Update the JS to reference our revved partials']
]
}
}
}
The important additions are the patterns. You need to say to usemin how to search the html links in javascript.
The assetDirs option is also important to set because usemins fileprocessor.js looks for the revved files by a map of unrevved to revved files and if the assetDirs is not set properly it won't find it.
My javascript foo is okay but I haven't kept up with the latest and greatest (we don't use Node.js in backend). What is the modern practice of structuring client side javascript? We organize ...
My javascript foo is okay but I haven't kept up with the latest and greatest (we don't use Node.js in backend). What is the modern practice of structuring client side javascript? We organize ...
This is my collection: { "_id" : 10926400, "votes": 131, "author": "Jesse", "comments" : [ { "id" : 1, ...
This is my collection: { "_id" : 10926400, "votes": 131, "author": "Jesse", "comments" : [ { "id" : 1, ...
I've just figured out that object in React's state that have multiple children cannot be rendered easily. In my example I have component which speaks with third-party API through AJAX: var Component ...
I've just figured out that object in React's state that have multiple children cannot be rendered easily. In my example I have component which speaks with third-party API through AJAX: var Component ...
I'm working on an app that starts a Google Hangout On Air. We do this programmatically using Javascript and the Google+ Hangouts API. We've successfully created the button and when you click it, it ...
I'm working on an app that starts a Google Hangout On Air. We do this programmatically using Javascript and the Google+ Hangouts API. We've successfully created the button and when you click it, it ...