I have a strange issue, when I include the last CSS file (assets/fonts/montserrat/style.css), then the assets/css/style.css doesn't get loaded. It seems to have to do with duplicate naming of files, when I rename the stylesheet to montserrat.css, the issue is gone.

How do I solve this issue while keeping the naming of files intact?


name = mytheme
description = My custom theme
core = 7.x

stylesheets[all][] = assets/plugins/bootstrap/css/bootstrap.min.css
stylesheets[all][] = assets/plugins/font-awesome/css/font-awesome.min.css
stylesheets[all][] = assets/css/style.css
stylesheets[all][] = assets/css/custom.css
stylesheets[all][] = assets/fonts/montserrat/style.css
  • I mean not to be a jerk, but ... you already solved the problem. – user5482 Feb 23 '17 at 22:09
  • The question is why, and how to solve it while keeping the duplicate names. It seems preposterous that you would have to rename your files for this. – Pim Feb 23 '17 at 22:10

the answer is in the drupal_get_css doco page:

Themes may replace module-defined CSS files by adding a stylesheet with the same filename. For example, themes/bartik/system-menus.css would replace modules/system/system-menus.css. This allows themes to override complete CSS files, rather than specific selectors, when necessary.

If you look at the source code at the bottom of the page, the array that contains the css has the basename of the file as the key. So this is an intentional feature.

You will just have to keep the renamed file.

Hope this helps. :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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