https://github.com/stepicorg/ember-cli-environment-config-replace
Simple templating using config/environment.js at build time.
https://github.com/stepicorg/ember-cli-environment-config-replace
ember-addon ember-cli ember-cli-addon emberjs
Last synced: 9 months ago
JSON representation
Simple templating using config/environment.js at build time.
- Host: GitHub
- URL: https://github.com/stepicorg/ember-cli-environment-config-replace
- Owner: StepicOrg
- License: mit
- Created: 2021-08-31T06:03:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-31T06:26:56.000Z (over 4 years ago)
- Last Synced: 2025-04-28T14:21:26.531Z (9 months ago)
- Topics: ember-addon, ember-cli, ember-cli-addon, emberjs
- Language: JavaScript
- Homepage:
- Size: 170 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
ember-cli-environment-config-replace
==============================================================================
Simple templating using `config/environment.js` at build time.
Installation
------------------------------------------------------------------------------
```
ember install ember-cli-environment-config-replace
```
Usage
------------------------------------------------------------------------------
This addon looks for a `@{PROP}` pattern in files and replaces it with a `PROP`
from `environment/config.js` at build time.
Nested properties are also supported, just use `.` as delimiter: `@{PROP.A.B.C}`.
Options and their defaults:
```js
let app = new EmberApp(defaults, {
'ember-cli-environment-config-replace': {
enabled: true,
// A list of files to parse in `/dist` directory.
// NOTE: The replacement happens in the `postprocessTree` hook,
// so its essentially running once the files have already been processed.
files: [
'index.html',
'tests/index.html',
],
// Regex pattern for replacements.
// The regex must have a group to capture property name.
regex: /@\{\s?([\w-.]+)\s?\}/g
}
});
```
If `files` is a function, it's passed the
[`outputPaths`](https://cli.emberjs.com/release/advanced-use/asset-compilation/#configuringoutputpaths)
object. It's better to rely on this rather than hard-coding file paths, because output paths
for some assets can be configured in ember-cli.
```js
'ember-cli-environment-config-replace': {
files: outputPaths => [
outputPaths.app.html,
outputPaths.app.css.app,
]
}
```
Running tests
------------------------------------------------------------------------------
`npm test`