2

Having followed a number of different guides to try and create a Bartik sub theme that allowed me to use the Color module, the following was the last one I attempted that worked: http://drupal.org/node/800510#comment-3277090

However despite this working, none of the CSS files specified in my sub theme are working. Following is my info file:

; $Id: bartik.info,v 1.5 2010/11/07 00:27:20 dries Exp $

name = crxtr
description = A bartik sub theme
core = 7.x
base theme = bartik

stylesheets[all][] = css/crxtr.css
stylesheets[all][] = css/colors.css
stylesheets[all][] = css/crxtr-views.css

regions[header] = Header
regions[help] = Help
regions[page_top] = Page top
regions[page_bottom] = Page bottom
regions[highlighted] = Highlighted

regions[featured] = Featured
regions[content] = Content
regions[sidebar_first] = Sidebar first
regions[sidebar_second] = Sidebar second

regions[triptych_first] = Triptych first
regions[triptych_middle] = Triptych middle
regions[triptych_last] = Triptych last

regions[footer_firstcolumn] = Footer first column
regions[footer_secondcolumn] = Footer second column
regions[footer_thirdcolumn] = Footer third column
regions[footer_fourthcolumn] = Footer fourth column
regions[footer] = Footer

settings[shortcut_module_link] = 0

; Information added by drupal.org packaging script on 2011-01-05
version = "7.0"
project = "drupal"
datestamp = "1294208756"

Now the CSS from my front page reads:

<style type="text/css" media="all">@import url("http://local.tracker/modules/system/system.base.css?ll8uzr");
@import url("http://local.tracker/modules/system/system.menus.css?ll8uzr");
@import url("http://local.tracker/modules/system/system.messages.css?ll8uzr");
@import url("http://local.tracker/modules/system/system.theme.css?ll8uzr");</style> 
<style type="text/css" media="all">@import url("http://local.tracker/misc/ui/jquery.ui.core.css?ll8uzr");
@import url("http://local.tracker/misc/ui/jquery.ui.theme.css?ll8uzr");
@import url("http://local.tracker/modules/overlay/overlay-parent.css?ll8uzr");
@import url("http://local.tracker/modules/contextual/contextual.css?ll8uzr");</style> 
<style type="text/css" media="all">@import url("http://local.tracker/modules/comment/comment.css?ll8uzr");
@import url("http://local.tracker/modules/field/theme/field.css?ll8uzr");
@import url("http://local.tracker/modules/node/node.css?ll8uzr");
@import url("http://local.tracker/modules/search/search.css?ll8uzr");
@import url("http://local.tracker/modules/user/user.css?ll8uzr");
@import url("http://local.tracker/sites/all/modules/views/css/views.css?ll8uzr");</style> 
<style type="text/css" media="all">@import url("http://local.tracker/sites/all/modules/ctools/css/ctools.css?ll8uzr");
@import url("http://local.tracker/modules/shortcut/shortcut.css?ll8uzr");
@import url("http://local.tracker/modules/toolbar/toolbar.css?ll8uzr");</style> 
<style type="text/css" media="all">@import url("http://local.tracker/themes/bartik/css/layout.css?ll8uzr");
@import url("http://local.tracker/themes/bartik/css/style.css?ll8uzr");
@import url("http://local.tracker/sites/default/files/color/crxtr-5fa2c1e5/colors.css?ll8uzr");</style> 
<style type="text/css" media="print">@import url("http://local.tracker/themes/bartik/css/print.css?ll8uzr");</style>

The 3 CSS files specified in the info file are present and contain rules.

Following is an excerpt also from the head, which shows that at least on some level, the info file is being parsed and the CSS files are being recognized:

<!--//--><![CDATA[//><!--...,"sites\/all\/themes\/crxtr\/css\/colors.css":1,"sites\/all\/themes\/crxtr\/css\/crxtr.css":1,"sites\/all\/themes\/crxtr\/css\/crxtr-views.css":1,...//--><!]]>

I've tried clearing the cache about a billion times to no effect. I just tried adding the following line to my info file and corresponding CSS file, and the only effect was that it actually removed the bartik/css/style.css from the HEAD, rather than substituting or adding the crxtr/css/style.css:

stylesheets[all][] = css/style.css

Please let me know if I can provide any more info to diagnose.

Edit: Followed the same process to create a subtheme using NineSixty and have had no problems with it finding and loading my sub-theme CSS files.

3 Answers 3

2

Please rename your css file name style.css to blah.css, it will works.

1

I'm new to Drupal 7, and those days I also had problems subtheming Bartik myself or copying and modifying the whole Bartik folder into my themes folder. At the end, I did using the only 'official' Bartik sub-theme I found (Antonelli) and then changing CSS and stuff in the info of Antonelli instead.

1
  • Thanks for the info! Did you need to do anything special to get theme preprocess hooks working?
    – DanH
    May 17, 2011 at 14:57
0

I'd just like to point out that it appears Drupal is quite particular about the location and/or name of your css file when including it via a module's .info file. This is what worked for me:

Directory

sites/all/modules/custom/my_module/

Files

my_module.info
my_module.module
css/my_module.css // DOES NOT WORK
css/foo.css

my_module.info

name = My Module
description = My awesome module
core = 7.x
package = Other
stylesheets[all][] = css/my_module.css // DOES NOT WORK
stylesheets[all][] = css/foo.css

For some reason, .css files included via a module's .info file, cannot have the same filename as the module itself. This means the my_module.css file will not be loaded.

Be sure to flush all of Drupal's caches after making changes to a .info file.

Your Answer

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

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