Linking Stylesheets

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
sds
Propeller Head
Posts: 48
Joined: Tue Jun 26, 2018 11:29 am
Location: Tucson

Linking Stylesheets

Post by sds »

Hey everyone. I see a lot of output online that have multiple stylesheets. I have a few projects, one that's pretty massive for enterprise software, but I've never done anything like carry multiple stylesheets or linking stylesheets like MadCap's newer short video: https://youtu.be/K4HaN5X7TAk?si=l7NsomETy6xZera7

I can see reasons for having multiple stylesheets and maybe choosing to link certain topics to specific CSS, but can someone give me some examples of why you would link stylesheets like in the video?

How do you use multiple stylesheets? If you link the stylesheets like in the video, what is the reason? In the example in the video, why wouldn't you just style the h1 with an underline and add the h6 style to the main stylesheet?
Psider
Propellus Maximus
Posts: 816
Joined: Wed Jul 06, 2011 1:32 am

Re: Linking Stylesheets

Post by Psider »

One reason I could imagine is if you have a corporate stylesheet that defines the font size and font for headings etc, but you develop help for several products which are branded using different colours.

You project stylesheet would define the specific colours to use for the headings, but not font size or font, then you would link the corporate stylesheet to it, so that the correct font size and font are applied.

This also means that all the settings that are common to all your projects could be maintained in a single stylesheet and can be changed once. For example, if your corporate font changes, you change it in the corporate stylesheet once, rather than having to update the font in the stylesheet for every project.
trent the thief
Propellus Maximus
Posts: 613
Joined: Wed Feb 01, 2006 6:21 am
Location: Off in the dark....

Re: Linking Stylesheets

Post by trent the thief »

Another reason is when a project uses external resources.

Font Awesome and Glyph Icons both provide their own CSS to support their icon packages. I use Laura Johnson's Tabbing system and keep its CSS separate even though it's small and easily added to the primary css.

Segregating the primary Flare project's CSS separate from any other CSS lets you add or remove external features without the possibility of accidentally breaking the primary css. It keeps everything more orderly, too. I sued to stick the CSS for everything into one file, and trust me, that's not a way forward. Keep things modular as much as you can and you'll have fewer issues.
Trent.

Certifiable.

Image

umm...
I meant MAD Certified.

Official Propeller Beanie Owner :-)

:flare: Are you on Flare's Slack channels? PM me for an invitation! :flare:
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: Linking Stylesheets

Post by NorthEast »

In my projects, my main/primary stylesheet only contains a list of links to other stylesheets (about 8 of them) and nothing else.
I have multiple stylesheets to segregate different parts of the CSS, as some are specific to different projects and outputs.

This means that if I need to change which stylesheets are included/linked in a target, I just change the stylesheet links in that target's main/primary stylesheet, and I don't have to change individual stylesheet links in topics or template pages.

I have to do it this way as you can't set conditions on anything in the <head> section, which means you can't use conditions to include/exclude stylesheet links.

(I'm aware you can use Flare's target mediums to include specific CSS in a target, but how that works behind the scenes is a kludge and has many limitations. It doesn't work like a true media type.)
trent the thief
Propellus Maximus
Posts: 613
Joined: Wed Feb 01, 2006 6:21 am
Location: Off in the dark....

Re: Linking Stylesheets

Post by trent the thief »

That's a good idea, NE. It'd sure end accidental edits in the wrong sections.
Trent.

Certifiable.

Image

umm...
I meant MAD Certified.

Official Propeller Beanie Owner :-)

:flare: Are you on Flare's Slack channels? PM me for an invitation! :flare:
Post Reply