#### 31.4.3 Directing DITA2Go to generate a CSS file

The first time you convert files for a project, if you intend to use CSS, probably you will want DITA2Go to generate a new CSS file, so you can use a style sheet that contains the equivalents of your format settings. You should also specify a name for the CSS file (see §31.4.2 Designating and locating a CSS file); for example:

    [CSS]
    UseCSS=Yes
    WriteCssStylesheet=Once
    CssFileName=MyStyles.css

When WriteCssStylesheet=Once, DITA2Go generates a new CSS file, but only if no CSS file of the same name (in this example, MyStyles.css) already exists in the project directory. This is probably the best setting to use in most circumstances; you can leave this setting in place, and any changes you make directly to the CSS file will be preserved the next time you run the conversion. On the other hand, changes you make to formats will not be reflected in the CSS file.

Force a new CSS, update CSS from formats

To force DITA2Go to generate a new CSS file, overwriting any existing CSS file of the same name in the project directory:

    [CSS]
    WriteCssStylesheet=Always

If you never make changes directly to the CSS file, you can let DITA2Go generate a CSS file each time; then any changes you make to your formats are updated automatically in the CSS file.

Update CSS directly

If you make changes directly to the CSS file, to prevent your changes from being overwritten, for subsequent conversion runs you must change this setting to Once or to Never:

    [CSS]
    WriteCssStylesheet=Never

Styles based on configuration settings

You can have it both ways, by specifying CSS settings in your configuration file for particular formats; see §31.8.3 Overriding styles in DITA2Go-generated CSS files

Previous Topic: 31.4.2 Designating and locating a CSS file

Next Topic: 31.4.4 Understanding effects of the older Stylesheet setting

Parent Topic: 31.4 Specifying CSS file and link options

Sibling Topics:

31.4.1 Specifying CSS options in a DITA2Go configuration file

31.4.2 Designating and locating a CSS file

31.4.4 Understanding effects of the older Stylesheet setting

Table of Contents • Index