Sub-themes & inheritance

rcourtna - May 2, 2008 - 23:02

Hi all,

I've just started playing with sub-themes, and love them! I've run into a problem with stylesheet inheritance.

I define my style files in my parent theme's .info file like so:

name = Parent
description = It's so cool I wrote a poem about it.
version = VERSION
core = 6.x
engine = phptemplate

scripts[] = js/jquery.styleswitch.js
scripts[] = js/jquery.coda-slider.js

Now in my sub-theme, I'd like to omit js/jquery.coda-slider.js. The docs state that "If the file exists inside the sub-theme, then it will be used while omitting the file will prevent it from loading." (http://drupal.org/node/171209#styles-override-parent).

So I omit it in my sub-theme's .info file:

name = Sub
description =not so cool
version = VERSION
core = 6.x
engine = phptemplate
base theme = parent

scripts[] = js/jquery.styleswitch.js

This results in my sub-theme still inheriting "js/jquery.coda-slider.js" from the parent theme. Not what I'd expect.

Is this a documentation bug, a code bug, or am I doing this wrong?

Thanks!
Ryan

It's not a documentation

level02 - May 2, 2008 - 23:20

It's not a documentation bug, the page to which you refer is about style sheets. According to the Sub-themes, their structure and inheritance page all JavaScripts defined in the parent theme are inherited in a sub-theme. Could you switch your parent and sub themes around?

Typo

rcourtna - May 3, 2008 - 01:13

You are right, my bad, i pasted the wrong lines. I see this inheritance problem with stylesheets (not javascript). So like:

name = Parent
description = It's so cool I wrote a poem about it.
version = VERSION
core = 6.x
engine = phptemplate

stylesheets[screen][] = css/style1.css
stylesheets[screen][] = css/style2.css

and

name = Sub
description =not so cool
version = VERSION
core = 6.x
engine = phptemplate
base theme = parent

stylesheets[screen][] = css/style2.css

and in this case, my sub-theme still inheriting "css/style1.css" from the parent theme. Not what I'd expect.

Thanks

There is an issue here:

level02 - May 3, 2008 - 17:32

If you want to override

dvessel - May 3, 2008 - 19:18

If you want to override "css/style1.css", you must redefine it from the sub-theme. You only redefined style2.css.

http://drupal.org/node/171209#styles-override-parent

joon park
www.dvessel.com

 
 

Drupal is a registered trademark of Dries Buytaert.