Why doesn't my theme detect/read some of my CSS files?

Why doesn't my theme detect/read some of my CSS files?

by Zarah Khan -
Number of replies: 4

I am writing my first theme. I have a few CSS stylesheets in the style directory. I have added them to the config.php file, but some of them are Not being detected/read/applied.

In config.php,

$THEME->sheets = array('header', 'slider', 'section-one', 'section-two', 'section-three', 'section-four', 'footer', 'frontpage', 'core');

Particularly section-three and section-four are not being applied.

I have created separate CSS files for different parts/sections of the frontpage, because I am fairly new to it and I want to keep it simple.

I have read about the practice of creating a CSS file for each layout page (rather than each section of page - the way I am doing it) in Themes 2.0 developer docs, but still atleast the rules should be applied?

I also placed them as first two elements of the $THEME->sheets array in order to rule out clashes, but that did not work.

I don't have `Theme Designer Mode` turned on, but I do `Purge All Caches` every time.

I did check the spellings of file names and directories in which they are located, those things are correct. :s What should I do?



Average of ratings: -
In reply to Zarah Khan

Re: Why doesn't my theme detect/read some of my CSS files?

by Zarah Khan -

Hasn't anyone ever faced something like this? :s


In reply to Zarah Khan

Re: Why doesn't my theme detect/read some of my CSS files?

by Jason Ferguson -

Turn theme designer mode on.   Do your styles apply properly?  If so,  are you pre-minifying your files?

With theme designer mode on,  after a purge cache, does your cache link change when you view source on the index,  ie:

https://my.moodleinstall/theme/styles.php/themename/{IDENTIFIER}/all

After a purge cache, the identifier number in brackets should change.  If it doesn't,  it usually indicates Moodle is erroring out trying to minify your css or had some kind of issue writing the new cache file.

Make sure all debugging is enabled and tail your error logs during a purge cache.    


In reply to Jason Ferguson

Re: Why doesn't my theme detect/read some of my CSS files?

by Zarah Khan -

  • I don't understand a lot of what you're saying. I'll format those parts in bold."Turn theme designer mode on.   Do your styles apply properly?  If so,  are you pre-minifying your files?I turned it on. No, there is no difference, the styles don't apply properly.


i tried typed this in the URL bar in my browser: "http://localhost/moodle/theme/styles.php/testy/{IDENTIFIER}/all" and pressed Enter. The link changed to "http://localhost/moodle/theme/styles.php/testy/%7BIDENTIFIER%7D/all"

Then I did a "Purge All Caches", and after that refreshed the page. Then again typed "http://localhost/moodle/theme/styles.php/testy/{IDENTIFIER}/all" in the browser address bar and pressed Enter. The link changed to "http://localhost/moodle/theme/styles.php/testy/%7BIDENTIFIER%7D/all" again.


  • Make sure all debugging is enabled and tail your error logs during a purge cache.    

Debugging Mode is turned on and I am not getting any errors or warnings or notices in the browser.

In reply to Zarah Khan

Re: Why doesn't my theme detect/read some of my CSS files?

by scott braithwaite -

Just a thought

when I want to see if my styles are being picked up at all I always check the inspect element to make sure they are displaying there, and if not then I look at adding the !important tag to test to see if css else where has overuled this or have I not adding the relevant classes to the CSS file correctly.


Also you may not get an error for styles but the most important thing to work out is why the style is not displaying, hope that these checks bring back something for you but if not still let me know and will try to dig into the problem for you as should have chance to have a look for you this afternoon.


Scott smile

Average of ratings: Useful (1)