https://github.com/fielding/postcss-env-replace
PostCSS plugin that will replace Templates with environment-specific content
https://github.com/fielding/postcss-env-replace
Last synced: about 1 month ago
JSON representation
PostCSS plugin that will replace Templates with environment-specific content
- Host: GitHub
- URL: https://github.com/fielding/postcss-env-replace
- Owner: fielding
- License: mit
- Created: 2016-11-25T18:30:06.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-25T18:56:28.000Z (over 9 years ago)
- Last Synced: 2025-10-10T17:45:19.219Z (10 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# PostCSS Env Replace [![Build Status][ci-img]][ci]
[PostCSS] plugin that will replace Templates with environment-specific content.
[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/stehefan/postcss-env-replace.svg
[ci]: https://travis-ci.org/stehefan/postcss-env-replace
```css
.foo {
background-image: url(env_replace(BASE_URL)/myAwesomeImage.jpg);
}
```
```css
.foo {
background-image: url(http://localhost/myAwesomeImage.jpg);
}
```
## Installation
```
npm install postcss-env-replace --save-dev
```
## Usage
```js
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'
}
}
}) ])
```