How to use the decl function from postcss

Find comprehensive JavaScript postcss.decl code examples handpicked from public code repositorys.

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)
```
fork icon25
star icon70
watch icon12

+ 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}%`,
});
fork icon0
star icon0
watch icon0

+ 8 other calls in file