Skip to content
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

Make it easier to edit custom blocks CSS #150

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

foliovision
Copy link
Contributor

We like to create custom blocks with Genesis. However when we edit the blocks/blocks.css file in the theme folder we have to clear the browser cache each time and tell that to our clients.

We would much prefer is that file would be always loaded fresh from the server - at least if there was a change in the content.

That's why we did a miniature change which puts the file modification timestamp into that stylesheet URL.

This way a browser is forced to load the new file if you make modifications to your custom blocks CSS file.

Very important specially if you use a CDN.

Changes

  • ensured the custom blocks.css file URL gets the query argument which changes when the file is modified

Testing instructions

  • check that your wp-content/themes/monochrome-pro/blocks/blocks.css loads with a timestamp in URL query, like https://example.com/wp-content/themes/monochrome-pro/blocks/blocks.css?ver=1690892560

This was a browser is forced to load the new file if you make modifications to your custom blocks CSS file.

Very important specially if you use a CDN.
@kienstra
Copy link
Contributor

kienstra commented Aug 1, 2023

Hi @foliovision,
Thanks a lot for this fix. It'll go out in the release this week.

@kienstra kienstra self-requested a review August 1, 2023 19:30
Copy link
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. We do this in other plugins.

@kienstra kienstra merged commit 5798dcf into studiopress:develop Aug 1, 2023
@AlecKinnear
Copy link

Thanks for the quick reaction. Nice change from contributing to WordPress core (seven year arguments on 300x performance improvements for large sites). Glad to be of service. Keep up the good work, Genesis Blocks are very impressive.

@kienstra
Copy link
Contributor

kienstra commented Aug 2, 2023

@foliovision,
Haha! Thanks a lot for your fix! it's a huge compliment you use Genesis Blocks.

@kienstra
Copy link
Contributor

You probably noticed, but we deployed this last week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants