How to use the decl function from postcss
Find comprehensive JavaScript postcss.decl code examples handpicked from public code repositorys.
GitHub: antgod/blog
222 223 224 225 226 227 228 229 230 231
``` const texts = ['label', 'a', 'span'] if(texts.includes(rule.selector)) { // 插入样式属性: color, background-color const color = postcss.decl({ prop: 'color', value: 'black' }) const bgColor = postcss.decl({ prop: 'background-color', value: 'white' }) rule.prepend(color, bgColor) } console.log(`${rowIndex + 1 }.处理选择器:`, rule.selector) ```
25
70
12
+ 3 other calls in file
200 201 202 203 204 205 206 207 208
let backgroundImage = postcss.decl({ prop: "background-image", value: `url(${image.spriteUrl})`, }); let backgroundSize = postcss.decl({ prop: "background-size", value: `${backgroundSizeX}% ${backgroundSizeY}%`, });
0
0
0
+ 8 other calls in file
postcss.plugin is the most popular function in postcss (94 examples)