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

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.

主站蜘蛛池模板: 定西市| 神农架林区| 日土县| 合水县| 南川市| 镇康县| 元谋县| 胶南市| 饶河县| 托里县| 蕉岭县| 安仁县| 天台县| 宣城市| 成安县| 清远市| 卢龙县| 兖州市| 兴义市| 宝应县| 兴义市| 沁源县| 惠东县| 安岳县| 科技| 石台县| 常熟市| 沙坪坝区| 盐山县| 宝清县| 青州市| 湘潭市| 津市市| 吐鲁番市| 临泽县| 女性| 永嘉县| 临颍县| 饶平县| 武义县| 中西区|