- Mastering PostCSS for Web Design
- Alex Libby
- 165字
- 2021-07-14 11:12:23
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:
- Fire up a NodeJS command prompt, then change the working directory to our project area.
- At the command prompt, enter the following command, then press Enter:
npm install --save-dev postcss-css-variables
- 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.
推薦閱讀
- Facebook Application Development with Graph API Cookbook
- ServiceNow Application Development
- 零基礎搭建量化投資系統:以Python為工具
- Java EE 6 企業級應用開發教程
- Java:Data Science Made Easy
- 精通API架構:設計、運維與演進
- Backbone.js Blueprints
- Redis Essentials
- Nexus規?;疭crum框架
- 嚴密系統設計:方法、趨勢與挑戰
- 深入淺出RxJS
- WebRTC技術詳解:從0到1構建多人視頻會議系統
- C和C++游戲趣味編程
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- 零基礎看圖學ScratchJr:少兒趣味編程(全彩大字版)