官术网_书友最值得收藏!

Adding variable support to PostCSS

The beauty of PostCSS plugins is that most (if not all) can be installed using the same method as PostCSS itself, we can use the package manager of Node.js to handle the process.

We'll start with postcss-css-variables, which we will use to handle variable support; the source for this plugin is available from https://github.com/MadLittleMods/postcss-css-variables. Let's get it installed:

  1. Fire up a NodeJS command prompt, then change the working directory to our project area.
  2. At the command prompt, enter the following command, then press Enter:
    npm install --save-dev postcss-css-variables
    
  3. If all is well, we should see the results of the installation appear, as shown in this screenshot:

At this point, Node will have also added an entry to the package.json file for the new plugin. Perfect—we can now put it to good use and switch to using the plugin in place of using SASS. Let's take a look at how to achieve this, as part of the upcoming exercise.

主站蜘蛛池模板: 梅州市| 沅江市| 金门县| 墨竹工卡县| 繁峙县| 富顺县| 贵州省| 临夏市| 安远县| 云南省| 微博| 北碚区| 花垣县| 高淳县| 邻水| 新巴尔虎左旗| 潜江市| 桐柏县| 长汀县| 贡嘎县| 沙坪坝区| 汾西县| 南乐县| 阆中市| 鄂伦春自治旗| 平和县| 固镇县| 博爱县| 太原市| 常宁市| 龙岩市| 阿克苏市| 那曲县| 东阿县| 中超| 开封市| 子长县| 鞍山市| 郧西县| 赣州市| 高陵县|