postcss-imageurlreplace
v1.1.0
Published
css replace background url domain ```javascript const imageUrlReplace = require('imageurlreplace');
Downloads
2
Readme
postcss-imageurlreplace
css replace background url domain
const imageUrlReplace = require('imageurlreplace');
postcss([
imageUrlReplace({
domains: [
{
site: "up",
host: "//p1.xxx.com"
},
{
site: "ali",
host: "//pu.xxx.com"
},
]
})
])
option
- domain
- domains
example-domain
imageUrlReplace({domain: '//p.xxx.com'})
/*src*/
.chart{
background-image: url('../images/chart_bg.png');
}
/*dest*/
.chart {
background-image: url('//p.xxx.com/images/chart_bg.png');
}
example-domains
imageUrlReplace({
domains: [
{
site: "up",
host: "//p1.xxx.com"
},
{
site: "ali",
host: "//pu.xxx.com"
},
]
})
/*src*/
.chart{
background-image: url('../images/chart_bg.png');
}
/*dest*/
body .chart_container {
background-image: url('//p1.xxx.com/images/chart_bg.png');
}
body.up .chart_container {
background-image: url('//p1.xxx.com/images/chart_bg.png');
}
body.ali .chart_container {
background-image: url('//pu.xxx.com/images/chart_bg.png');
}