I have added a module specific css file from within a module.

I have a layout file at app/code/Vendor/Module/view/adminhtml/layout/catalog_product_edit.xml with the following contents:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <css src="Vendor_Module::css/modulestyles.css" />

I then placed a css file at app/code/Vendor/Module/view/adminhtml/web/css/modulestyles.css with the following contents:

div {
    background-color: blue;

This works properly and I get all the divs with blue backgrounds. However I am having an issue when I change the contents of the css file. The only way I can get the site to update to the newer css is by clearing out pub/static and var/view_preprocessed and then refreshing the page (if I am in developer mode) or running a static deploy with this command if I am in production mode:

bin/magento s:s:d

My issue is that the page takes quite a while to reload the page in developer mode or to do the static deploy. Is there no quicker way to update a module based css file?

1 Answer 1


Your steps seem correct. Maybe your browser cache got in the way. If you use google chrome, hold down the refresh button and use Hard Reload.

sometimes a CDN (Content Delivery Network) hold old files as well.

If still no look, load the CSS in your bowser driectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.