Creating snippets - default style sheet

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
Bill Stevens
Propeller Head
Posts: 20
Joined: Tue Nov 28, 2006 6:32 am
Location: Manchester, UK

Creating snippets - default style sheet

Post by Bill Stevens »

I am using MadCap v6 on a project that was created using version v3.1 and I have created new snippets by:

a) selecting text within a topic using Format => Create Snippet, and
b) Project => Add Snippet

In both cases, the snippet is created, with all the appropriate styles but it is using a "default" style sheet - not the style sheet I am using in the project. Snippets that I created in v3.1 use the project's style sheet.

When I view the HTML code of the a v6 snippet (Open with => Internal Text Editor) and compare it with snippets from v3.1, they do not have the <head> </head> tags. Here is an example of a head from a v3.1:
<head>
<link href="../Stylesheets/excellence.css" rel="stylesheet" type="text/css" />
<link href="../TableStyles/grey_tables.css" rel="stylesheet" MadCap:stylesheetType="table" />
</head>


I cannot recall how I created the v3.1 snippets.

Are v6 snippets supposed to be like this? Am I doing something wrong? I cannot find a way of associating the project styIe sheet with a snippet.

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

Re: Creating snippets - default style sheet

Post by LTinker68 »

You don't associate stylesheets with snippets. When you insert the snippet into a topic then it's automatically associated with a stylesheet because the topic itself is associated with a stylesheet, or rather, will be at build time. The advantage of not associating the snippet to a stylesheet is that you can reuse that snippet in any output without worrying about whether it matches the rest of the topics in the output. For instance, your main topic stylesheet might have a paragraph font size of 8pt Verdana, but you might have a second stylesheet for mobile output that has a paragraph font size of 12pt Verdana. If you associated the snippet to the main topic stylesheet, then when the snippet was used in the mobile output the font size would be too small. By not associating the snippet, it'll use the 8pt Verdana when you build normal online output but 12pt Verdana when you build mobile output.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
Bill Stevens
Propeller Head
Posts: 20
Joined: Tue Nov 28, 2006 6:32 am
Location: Manchester, UK

Re: Creating snippets - default style sheet

Post by Bill Stevens »

Lisa,

Many thanks for your reply. Yes it makes sense now that you explained it.

Cheers
Bill
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: Creating snippets - default style sheet

Post by NorthEast »

LTinker68 wrote:The advantage of not associating the snippet to a stylesheet is that you can reuse that snippet in any output without worrying about whether it matches the rest of the topics in the output. For instance, your main topic stylesheet might have a paragraph font size of 8pt Verdana, but you might have a second stylesheet for mobile output that has a paragraph font size of 12pt Verdana. If you associated the snippet to the main topic stylesheet, then when the snippet was used in the mobile output the font size would be too small. By not associating the snippet, it'll use the 8pt Verdana when you build normal online output but 12pt Verdana when you build mobile output.
No, that's not right actually. If you add a stylesheet link to a snippet, that link is not carried through to the output at all. The snippet would use the formatting of the topic's stylesheet, regardless of whether the snippet had a stylesheet link or not.

You are right in saying that it's the stylesheet link in the topic (not snippet) that's important; as the snippet is formatted using the topic's stylesheet.

If you want to format a snippet using styles/classes from a stylesheet, then you'd need to add a stylesheet link to the snippet in order to see those styles in the style picker. The only thing to beware of is that if you use more than one stylesheet for your topics, then you need to make sure the styles you use in the snippet are available in all the stylesheets (that the snippet could be used with).
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Creating snippets - default style sheet

Post by LTinker68 »

Dave Lee wrote:No, that's not right actually. If you add a stylesheet link to a snippet, that link is not carried through to the output at all. The snippet would use the formatting of the topic's stylesheet, regardless of whether the snippet had a stylesheet link or not.
I wasn't saying that it could be done, I was explaining why MadCap didn't want to do it that way.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: Creating snippets - default style sheet

Post by NorthEast »

LTinker68 wrote:
Dave Lee wrote:No, that's not right actually. If you add a stylesheet link to a snippet, that link is not carried through to the output at all. The snippet would use the formatting of the topic's stylesheet, regardless of whether the snippet had a stylesheet link or not.
I wasn't saying that it could be done, I was explaining why MadCap didn't want to do it that way.
That's the thing though - it can be done; you can add a stylesheet link to a snippet, just like a topic. My point was that if you do add a stylesheet link, then it actually makes no difference to the output; but you were saying that it would.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: Creating snippets - default style sheet

Post by i-tietz »

Bill Stevens wrote:Are v6 snippets supposed to be like this? Am I doing something wrong? I cannot find a way of associating the project styIe sheet with a snippet.
We've made the same sort of experience.
But I didn't do empirical research on that - we just use one stylesheet for the whole project and we hardly ever assign it to our snippets. The only moment when I need a stylesheet in a snippet is: when I change or add sth and need the style picker for that. In that case I right-click on the html bar on the left and chose Stylesheet Links. In the window that opens then I kick my stylesheet to the left box ...
Post Reply