-
Notifications
You must be signed in to change notification settings - Fork 51
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
CSS assets are not able to bust cache after being updated #270
Comments
@claytoncollie When the file doesn't get added as it's own entry point but rather the CSS gets imported through the JS I was under the impression that the version hash of the JS file would include the changes of the CSS file and therefore could be used to bust the cache for both. (I agree it isn't as efficient...) The reason for running the CSS through the JS rather than having it defined as it's own entry point is hat it's the only way to get CSS hot reloading 🤔 |
Good to know @fabiankaegy I was wondering what this import was for. But if that is the case and we are importing all of our CSS into the JS files, we should not need to enqueue the frontend styles, correct? |
@claytoncollie @fabiankaegy if we include css in js we end up with a super big file and delay loading of js which is bad I think |
@claytoncollie No. They are still two separate files that are getting output. What I mean is that the They still need to get enqueued separately |
Yeah is is not what I meant. That is not happening :) |
Describe the bug
Currently, the package.json defines JS file paths, which builds the
*.assets.php
file for each asset. If we only define the JS assets, a corresponding CSS file is also compiled without an*.assets.php
file. And then, when we enqueue the CSS file, the version number that we are looking up with theget_asset_info
function is from the JS file, not the CSS file, causing the CSS files to stay cached.I proposed that we do the following.
Steps to Reproduce
cd
intowp-content
npm run build
dist
directory*.assets.php
file any of the CSS filesScreenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: