Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to load a custom css file for the admin panel from a custom module folder.

My layout xml file looks like this

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="Vendor_Module::test.css" />
    </head> 
</page>

I've also tried

<head>
    <css src="Vendor_Module::css/test.css" />
</head> 

I tried putting the file in

Vendor/Module/view/web/css/test.css

or

Vendor/Module/view/adminhtml/web/css/test.css

After each I cleared the cache, the page cache and the pub/static folder.

The css file is not loading. Does anyone know why ?

share|improve this question
1  
Assuming that your module is enabled, try running bin/magento setup:upgrade – R.S Feb 23 at 12:49
    
that worked... so php bin/magento setup:static-content:deploy is not enough.... do I have to run setup:upgrade every time i add new js or css file to a module ? – Lachezar Raychev Feb 23 at 13:08
    
I'm not sure, but bin/magento setup:upgrade always seem to solve my issue – R.S Feb 23 at 13:12
    
ok, 10x. one more question. When I write in a js file from a certain module, I always have to clear pub/static and regenerate full static content so I can check what I've done, how can I escape that on development mode ? – Lachezar Raychev Feb 23 at 13:14
    
According to devdocs.magento.com/guides/v2.0/config-guide/bootstrap/… development mode should not cache those files – R.S Feb 23 at 13:17
up vote 1 down vote accepted

Assuming that your module is enabled and configured correctly

Run

bin/magento setup:upgrade
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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