@import in style.css

Discussion corner for Developers of Serendipity.
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

@import in style.css

Post by yellowled »

As far as I remember, this isn't new, but I just stumbled across it again.

There are different ways to include stylesheets in a template. One way is @import. One could, for instance, have a master.css with the following content:

Code: Select all

@import url(css/reset.css);
@import url(css/typo.css);
@import url(css/colors.css);
etc., you get the picture. The benefit of this is a modularized stylesheet system. Anyway, if one uses this syntax in a template's style.css, it doesn't work. Doesn't even matter how one references the stylesheet to be included in the url( ) statement - it simply doesn't work in style.css, period.

However, if one actually uses a master.css or anything else != style.css, it works just fine. As we all know, style.css is "converted" in a s9y environment - the file which is actually included eventually is serendipity.css, which is style.css plus some plugin styles.

I'm guessing @import doesn't work here because PHP/Smarty get in the way during this conversion, correct? Since @ is used for some purposes in PHP/Smarty? Now, is there any way to "mask" @import and make it work in style.css? Or do we simply have to use a different stylesheet than style.css if we want to use @ in CSS?

YL
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: @import in style.css

Post by garvinhicking »

Hi!

Remember that the default style.css gets loaded from the root, not the template directory.

import url(templates/blabla/bla.css)

should thus work and be the sole reason. If you get the relative dirs right, it must work.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: @import in style.css

Post by yellowled »

garvinhicking wrote:import url(templates/blabla/bla.css)
Hmmm. That - of course - works. Even better, this:

Code: Select all

@import url({TEMPLATE_PATH}bla.css);
also works. I'm almost 100% sure I tried that before, and it didn't work then ... well, what do you know? Thanks, Garvin.

YL
constancy
Posts: 1
Joined: Wed Aug 19, 2009 8:25 am

Re: @import in style.css

Post by constancy »

How do i create layouts with css in dreamweaver? Pls i'm trying to switch from using the usual table layouts for webpages to css, so how do i make the layout that will hold all my text and images in it?
___________
free matrimonial
Post Reply