YUI Compressor is a tool for minifying CSS code. Minification or compression means removing all unnecessary characters, such as spaces, new lines, comments without changing the functionality of the source code. During development and debugging, these characters make code easier to read. At the production stage they only increase the size of code to be transferred.
Before you start
Installing and configuring the YUI Compressor
Compressing the CSS code
To compress your code on the fly, you need to configure the compressor as a GoLand File Watcher.
To create a File Watcher
In the Settings/Preferences dialog Ctrl+Alt+S, click File Watchers under Tools. The File Watchers page that opens shows the list of already configured File Watchers.
Click the or press Alt+Insert and choose the YUI Compressor CSS predefined template from the list.
In the Program text box, specify the path to the yuicompressor-<version>.jar file. If you installed the tool through the Node Package Manager, GoLand locates the required file itself and fills in the field automatically. Otherwise, type the path manually or click and choose the file location in the dialog box that opens.
Proceed as described in File Watchers.
GoLand creates a separate file with the generated output. The file has the name of the source CSS file and the extension min.css. The location of the generated file is defined in the Output paths to refresh field of the New Watcher dialog. However, in the Project Tree, by default it is shown under the source CSS file which is now displayed as a node. To change the default presentation, configure file nesting in the Project tool window.