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

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.

主站蜘蛛池模板: 双峰县| 沭阳县| 隆昌县| 铁岭县| 徐闻县| 离岛区| 乌兰浩特市| 汝阳县| 历史| 西乌| 达孜县| 浦县| 依安县| 林西县| 神池县| 六枝特区| 宣汉县| 同江市| 房产| 镇原县| 微山县| 留坝县| 霞浦县| 东阿县| 历史| 津市市| 石嘴山市| 梁山县| 鲁甸县| 大城县| 鄄城县| 临泽县| 黑山县| 微山县| 宁南县| 工布江达县| 密山市| 沂源县| 济南市| 潼关县| 教育|