-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.0.0 - changes to the way the plugin works #147
Comments
With this change, it's becoming clear that some of the current options and features will be remove. I will keep this list up to date:
|
Hey @HollandBen, I’ve been testing the new branch. This is a good change. A few issues:
|
Hey, thanks for testing the next version 👍
Can you explain why this is? The current version of this plugin follows this pattern of finding an asset and then busting it, but with the new approach, all assets are busted and then references are updated. The main problem I can see people having with this is that it will created a lot of noise with new files being created all the time. My response to that would be to have your build pipeline setup in a way that each run of this task is done against a new, clean file system. The responsibility of this plugin is to just bust assets, not to clean up after or deal with files that have already been hashed. |
@HollandBen here’s an example: {
options: {
baseDir: 'public',
assets: 'assets/*',
deleteOriginals: true
},
files: [
'templates/only-one-template.jade'
]
} This will rename all the files in The others assets – that are not used by that template will be renamed as well. Thus the other templates will fail including the referenced asset files. |
I've been thinking about removing the |
@HollandBen fair enough. I’ll update the PR to only include the two fixes. |
I'm looking to ship this after next week - finally!! |
I've created a new You can install the beta using |
@HollandBen I am unable to get this to work for my project. I get the error:
I am using Grunt 0.4.5 and Node 0.12.7. My gruntfile looks like this: cacheBust: {
assets: {
files: [{
expand: true,
cwd: 'client/js',
src: ['*.js'],
dest: 'test/js'
}]
}
}, |
Hi @camwes. Is this using the beta version of the plugin? I can see from your configuration that you are only telling the plugin where to find the assets, but not telling it which files need to have their references updated. |
@HollandBen I am using the beta version. It is not very clear from the docs and examples what the difference is. Are you saying that the files attribute only determines where the files can be found. If so, how do I choose which files need to have their references updated? |
Was able to get this working after thinking a little more abut your advice. Working version looked like this: cacheBust: {
prod: {
options: {
assets: [
'static/assets/dist/js/index.js',
]
},
files: [{
expand: true,
deleteOriginals: false,
cwd: 'static/assets/dist/js',
src: [
'index.js'
],
}]
}
}, This is a agreat improvement on the plugin and I look forward to testing it some more. |
Glad you got it working @camwes. Can you elaborate on what wasn't clear in the documentation? I've changed the |
Moving the default package on npm to be |
I have 2 questions for you 1) Can your following code take scr= ['Index.cshtml'] and how will you implement to get .less and other asset files from angular 4. Thanks. |
My proposal is to change the plugin to work in a slightly different way. Currently the plugin's entry point is a file (generally a HTML file) where it would parse the content looking for assets to bust. This restricts the plugin to things that it can parse, so in the case of JS files, we'd have to add a new parser for that. It also means that other languages, PHP being one, can't be handled elegantly.
Solution
The solution to these problems will be to reverse the order of actions; the new entry point being a folder of assets, busting them and then going through each file that you wish to bust and replacing references. This should clean up a lot of the code and remove a lot of the slightly finicky regex rules in there. Some options can also be removed with this approach,
enableUrlFragments
being one of them.I've created this issue incase anyone else has ideas about how to make the plugin better!
Edit
Latest code and implementation can be found in the
v1.0.0-beta
branch. If anyone wishes to test on this branch and change their workflow to the new method, that would be stellar!The text was updated successfully, but these errors were encountered: