Edit online

Minifying CSS Stylesheets

Minification (or compression) of a CSS document is the practice of removing unnecessary code without affecting the functionality of the stylesheet.

To minify a CSS, invoke the contextual menu anywhere in the edited document and choose the Minify CSS action. Oxygen XML Author opens a dialog box that allows you to:
  • Set the location of the resulting CSS.
  • Place each style rule on a new line.
After pressing OK, Oxygen XML Author performs the following actions:
  • All spaces are normalized (all leading and trailing spaces are removed, while sequences of white spaces are replaced with single space characters).
  • All comments are removed.
Note: The CSS minifier relies heavily upon the W3C CSS specification. If the content of the CSS file you are trying to minify does not conform with the specifications, an error dialog box will be displayed, listing all errors encountered during the processing.
The resulting CSS stylesheet gains a lot in terms of execution performance, but loses in terms of readability. The source CSS document is left unaffected.
Note: To restore the readability of a minified CSS, invoke the Format and Indent action from the Document > Source menu, the Source submenu from the contextual menu, or Source toolbar. However, this action will not recover any of the deleted comments.