PostCSS plugin that will replace Templates with environment-specific content.
.foo {
background-image: url(env_replace(BASE_URL)/myAwesomeImage.jpg);
}
.foo {
background-image: url(http://localhost/myAwesomeImage.jpg);
}
npm install postcss-env-replace --save-dev
postcss([ require('postcss-env-replace')({
environment: process.env.ENVIRONMENT || 'dev',
replacements: {
BASE_URL: {
prod: 'http://my.site',
stage: 'http://stage.my.site',
ci: 'http://ci.my.site',
dev: 'http://localhost'
}
}
}) ])