WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.53k stars 4.21k forks source link

Use asset hash for CSS version on custom blocks #67205

Open andreawetzel opened 17 hours ago

andreawetzel commented 17 hours ago

What problem does this address?

I have a custom block that was started with create-block. Both the editorScript and style paths are set in block.json. When I inspect the block in the editor, I see that the JavaScript file has the asset hash set as the ver number, but the CSS file is set to the version number set in block.json. The block CSS gets cached by the browser unless we increment the block version which is cumbersome during testing.

Screenshot from local testing that shows the version hash used for JS, block version number used for CSS Image

What is your proposed solution?

Use the hash as the CSS Version number in wp-scripts by default, or create an option to build the files this way