[pmwiki-users] css dir

Henrik Bechmann henrik.bechmann at sympatico.ca
Wed Sep 13 20:59:00 CDT 2006


Patrick,

I think the argument could go both ways, but actually when I think about 
it, your approach is better for this reason:

I gather that with the advent of IE7 there is an emerging standard in 
css file management which prescribes separating IE-specific rules (and 
hacks) in a separate file, called with variants of

  <!--[If IE]>
    <link rel='stylesheet' href='$SkinDirUrl/myskin-IE.css' 
type='text/css' />
  <![endif]-->

Since this requires template code anyway, may as well make the base 
myskin.css call just above it for clarity:

    <link rel='stylesheet' href='$SkinDirUrl/myskin.css' type='text/css' />

This situation conforms to your reasoning.

So the logic would be that the template and php files are loaded 
automatically to "prime the pump" as it were, and the rest is done in 
the above manner, or one of the other methods you prescribe in 
SkinGuilelines. The autoload in a field pubs/css/ could be thought of as 
an easy exception handling, or special case, mechanism.

And all related skin files are kept in the same directory by convention 
for clarity, and ease of maintenance and access.

FYI I've put myskin.js in the skin dir as well, for consistency. And I 
plan to have a shared directory in pub/skins/shared (called with 
$PubDirUrl/skins/shared/ -- well actually $FarmPubDirUrl/skins/shared/) 
for shared components.

Thanks for the feedback.

Best,

- Henrik

Patrick R. Michaud wrote:
> On Wed, Sep 13, 2006 at 02:17:36PM -0400, Henrik Bechmann wrote:
>   
>> Patrick R. Michaud wrote:
>>     
>>> I'm a little confused -- you say that the *skin's* css is being
>>> put into pub/css/Home.FrontPage.css ?  Why not have the skin's css
>>> in the skin directory, as opposed to using the per-page .css
>>> file in pub/css/ ?
>>>       
>> My aim here is to conform to PmWiki standards and practices (and in the 
>> process discover what they are<grin>). So I wanted to cluster the skin 
>> files in the prescribed way, with a minimal amount of code in the template.
>>
>> Indeed I had expected to find that if I put myskin.tmpl, myskin.php, and 
>> myskin.css into a skin directory pub/skins/myskin, and set 
>> $Skin='myskin', all the files would get picked up automatically. The 
>> myskin.tmpl and myskin.php do, but myskin.css doesn't (version 2.1.26).
>>     
>
> Ah, I see.  No, PmWiki doesn't automatically pick up any .css files
> from out of the skin directory; it never really occurred to me that 
> perhaps it should do that.  :-)
>
> But I'm pretty sure it's better if we let the skin's template (.tmpl)
> file control the loading of any .css files.  This lets the template
> control the order in which .css files are loaded, as well as making
> it easy to have some .css files be "optional" (several skins do this
> already).
>
> So, the "prescribed way" is to use a <link .../> tag in the template:
>
>     <link rel='stylesheet' href='$SkinDirUrl/myskin.css' type='text/css' />
>
>   
>> For one thing, the pub/skins/myskin/myskin.css option isn't mentioned in 
>> the section "CSS Files: Controlling Page Style" at 
>> http://www.pmwiki.org/wiki/Cookbook/SkinGuidelines.
>>     
>
> You're correct, that section definitely needs an update
> (and possibly the page could use some rewriting).
>
>   
>> Placing MyGroup.MyPage.css in the field's pub/css/ directory is the only 
>> configuration I could find that gets the skin file picked up automatically.
>>     
>
> And it only gets picked up for MyGroup.MyPage.  Other pages won't
> pick it up.
>
>   
>> [...] not what I expected, as the requirement for an explicit 
>> link for the css file seems inconsistent with the auto-load of the other 
>> two files.
>>     
>
> A valid point that hadn't occurred to me.  I've always thought of 
> the .css files as being like .gif images or other graphics that go 
> in the skin's directory, in that they get loaded only when (and where) 
> specified by the template file.
>
> Pm
>
>   

-- 

Henrik Bechmann
www.osscommons.ca
www.bechmannsoftware.com
Webmaster, www.dufferinpark.ca





More information about the pmwiki-users mailing list