One of the common Developer tools that is helpful when your Magento website has multi-version and they are needed to discover by the browser is using static file signatures.
About Static File Signatures
Static files can be monitored by changing digital signatures including JavaScript, CSS, images, and fonts. The signature is appended to the path after the base URL. If the signature of a file differs from what is currently cached in the browser, the latest version of the file is used.
For example, when you run the command
php bin/magento setup:static-content:deploy
to deploy static content, Magento will change the version deployed automatically.
The Config In Using Static File Signatures
To enable Signed Static Files, you should follow the below steps:
- Access the backend and log in to the admin account.
- On the Admin sidebar, go to Stores > Configuration > Advanced > Developer > Static Files Settings.
- Choose Yes to enable this config.
Besides that, you can also use the command line to enable or disable the above config.
php bin/magento config:set dev/static/sign <value>
with value is 1 (enable) or 0 (disable).
For example, when you enable, the URL will be shown as
http://magento2.com/pub/static/version1591840430/frontend/Magento/luma/en_US/mage/calendar.css
|
Or in another case, when you disable, the URL will be
http://magento2.com/pub/static/frontend/Magento/luma/en_US/mage/calendar.css |
Note: Config Static File Settings is available only when working in developer mode.
Conclusion
That’s about the guide to enable the using static file signatures in Magento.
Hope you will be pleased with this useful information.
BSS Commerce is one of the leading Multi-platform eCommerce solution and web development services providers in the world. With experienced and certified developers, we commit to bring high-quality products and services to optimize your business effectively.
CONTACT NOW to let us know your problems. We are willing to support you every time.