-
Notifications
You must be signed in to change notification settings - Fork 12k
Asset revisioning (long-term caching) #1817
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
Comments
I'm interested in the discussion around this, but have to say it is not a high priority at the moment. |
I have been bypassing rails crappy asset pipeline in favour of a js build pipeline for several years now. With the manifest approach, that is typically about 20 lines of code. Feel that would be the case for most server side web frameworks, but given that is a secondary use case, maybe have different build outputs based off of flags? something like I feel like control over whether or not hashing is done to file names is actually an orthogonal issue to adding json manifests. Elixir Phoenix is an example of a framework with decoupled hashing, to integrate with it you want to output your minified assets to a convention based directory, and then run a digest build task built into the framework. It would be great to have more fine grained support for both things in angular-cli |
I think its a very important feature |
Asset revisioning has been a best practice for years and is a requirement for most production applications - it's sad that the One thing to note with the |
The html loader module for webpack can do this. I'm using it in an Angular 4 + webpack 3 project (not angular-cli base though). This is a snippet from my webpack config: {
test: /\.html$/,
use: 'html-loader?interpolate'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: 'file-loader?name=assets/[name].[hash].[ext]'
}, The However there's one problem. This approach doesn't play well with AoT compilation, because the html-loader doesn't seem to be part of the AoT compilation pipeline. I'm not that experienced in webpack. Maybe someone has an idea? UPDATE It seems, the |
Any update on making this an official feature? As my latest research found out, all the pieces are in place like |
We currently add hashes to bundles, scripts, styles and all resources identified in styles. The option that controls this is We do not add hashes to the contents of the Images referenced in html templates are not processed at all either, for the reasons referenced in #3415. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'd like to know if it'd be possible to add asset revisioning feature with angular-cli@webpack. As far as I see chunk hashes are only added to
.js
files during--prod
build and are used in the generatedindex.html
I can think of two possible approaches:
rewrite
approach, e.g. https://github.com/smysnk/gulp-rev-all which parses the asset references (considering dependencies) than does re-writing in raw asset files. This would not require using custom helpers in templates/styles.manifest
approach, e.g. https://github.com/nickjj/manifest-revision-webpack-plugin which will populate a manifest file with raw => revisioned mapping. Using helpers in templates/styles could be used for determining the right asset to use.angular-cli: 1.0.0-beta.11-webpack.2
node: 6.2.2
os: darwin x64
The text was updated successfully, but these errors were encountered: