京寵展信息指南
973
2022-05-30
PostCSS 是一個允許使用 JS 插件轉換樣式的【工具】
autoprefixer 添加了 vendor 瀏覽器前綴的【插件】
PostCSS 文檔:https://github.com/postcss/postcss/blob/main/docs/README-cn.md
PostCSS Github: https://github.com/postcss/postcss
安裝
npm i postcss autoprefixer
1
Node.js使用代碼實例
// 引入工具和插件 const Postcss = require("postcss"); const Autoprefixer = require("autoprefixer"); // 設置插件 const processor = Postcss([Autoprefixer]); // 處理css const css = ` .box{ transform: scale(0.5); } `; processor.process(css, { from: undefined }).then(result => { result.warnings().forEach(warn => { console.warn(warn.toString()); }); console.log(result.css); }); /* 輸出: .box{ -webkit-transform: scale(0.5); transform: scale(0.5); } */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
CSS PostCSS
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。