Mapping styles between 2 stylesheets

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
phanna
Sr. Propeller Head
Posts: 114
Joined: Mon Apr 07, 2008 2:27 pm
Location: Vancouver

Mapping styles between 2 stylesheets

Post by phanna »

Hi,

I have a stylesheet that I want to apply to a project that has another stylesheet currently applied to it. The new stylesheet has different class names. How do I map styles from the old stylesheet to the styles in the new stylesheet so that I do't have to manually apply the new styles?

Many thanks!
P
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Mapping styles between 2 stylesheets

Post by LTinker68 »

Two options.

Option 1: Copy-and-paste the styles from the second stylesheet into the project's primary stylesheet.

Option 2: Keep both stylesheets in the project, but in the project's primary stylesheet, add a reference to the other stylesheet. I think the code you would add to the main stylesheet would be similar to the following:

Code: Select all

@import url(secondStyles.css);
Where secondStyles.css is the name of the second stylesheet. However, that assumes that the stylesheet is stored in the same directory as the main stylesheet. If it isn't, then you'll have to add the relevant path information before the file name.

That import reference should be at the top of the main stylesheet, so if you have two classes defined the same way, the styles in the main stylesheet will win because they'll be listed after the styles from the import stylesheet.

Someone correct me if I'm wrong about that line of code. I know you can do it, but I'm not entirely sure I'm showing the right code.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
phanna
Sr. Propeller Head
Posts: 114
Joined: Mon Apr 07, 2008 2:27 pm
Location: Vancouver

Re: Mapping styles between 2 stylesheets

Post by phanna »

Thanks. I'm not quite sure if this will help me, but I" probably just missing something.
Will these options take care of the following scenario?

I have a style called p.BO_Body in my stylesheet. I have a style called p.Body in my new stylesheet. I want all current instances of p.BO_Body to have p.Body applied to them.

Cheers,
P
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Mapping styles between 2 stylesheets

Post by LTinker68 »

No, you'd have to do a find-and-replace in the source code of all the topics in the project to change all instances of <p class="BO_Body" to <p class="Body". So if the project's main stylesheet has p.Body in it but some of your topics have paragraphs using p.BO_Body, then you do the F&R to change which class the paragraph is using.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
phanna
Sr. Propeller Head
Posts: 114
Joined: Mon Apr 07, 2008 2:27 pm
Location: Vancouver

Re: Mapping styles between 2 stylesheets

Post by phanna »

Gotcha. Thanks very much!

P
Post Reply