Contents
Minifying CSS
Minification or compaction means removing all unnecessary characters, such as spaces, modern lines, comments, without changing the functionality of the source code. During development and debug, these characters make code easier to read. At the product stage, they alone increase the size of code to be transferred. Most frequently compression is done as a measure in your build process, with tools like webpack. If you ‘re not using build tools, you can use stand-alone tools, such as CSSO or cssnano. To minify your code mechanically, you need to configure a CSSO File Watcher which will track changes to your files and run CSSO. By nonpayment, minification starts arsenic soon as a CSS file in the File Watcher ‘s oscilloscope is changed and saved. You can specify early events that invoke CSSO. Learn more from File Watchers.
Reading: Minifying CSS | PhpStorm
The generated decrease code is stored in a separate file with the list of the source CSS file and the extension min.css. The localization of this generated file is defined in the Output paths to refresh field of the New Watcher dialogue. however, in the Project Tree, the file with the decrease code is shown under the generator CSS file which is displayed as a node. To change this nonpayment presentation, configure file nesting in the Project creature window .
Before you start
- Make certain you have Node.js on your computer .
- Make sure the CSS and File Watchers required plugins are enabled on the Settings/Preferences | Plugins page, yellow journalism Installed, see Managing plugins for details .
Install csso-cli globally
- In the embedded Terminal ( Alt+F12 ), type :
npm install -g csso-cli
Create a CSSO File Watcher
- In the Settings/Preferences dialogue ( Ctrl+Alt+S ), chink File Watchers under Tools. The File Watchers page that opens shows the list of already configured File Watchers.
- Click
or crush Alt+Insert and select the CSSO CSS Optimizer predefined template from the number .
The New Watcher dialogue opens .
- In the Program text box, specify the localization of the
csso
feasible file. If you installedcsso-cli
through the Node Package Manager, PhpStorm locates the package itself and fills in the plain automatically with thecsso
alias Otherwise, type the path manually or clickand select the file location in the dialogue that opens .
- Accept the default File Watcher settings or reconfigure them, if necessary, as described in File Watchers, and chatter OK. PhpStorm brings you rear to the File Watchers page where the raw File Watcher is added to the tilt :
- Make sure the Enabled checkbox is selected.
Read more: How to Embed a Google Form: Flickroom
By nonpayment, the File Watcher will be available in the current stick out. To use it in early projects, select Global from the Level list .
last modified : 20 July 2021