ember-cli-multi-html-output
Advanced tools
Comparing version 0.1.0 to 0.2.0
13
index.js
@@ -20,4 +20,6 @@ /* eslint-env node */ | ||
const shell = this.project.require('shelljs'), | ||
targets = this.options.targets; | ||
const shell = this.project.require('shelljs'), | ||
merge = this.project.require('merge-obj'), | ||
defaults = this.options.defaults || {}, | ||
targets = this.options.targets; | ||
@@ -30,3 +32,4 @@ // Backups the index.html into a template. | ||
const outputFile = `${results.directory}/${target.outputPath}`; | ||
const outputFile = `${results.directory}/${target.outputPath}`, | ||
macros = merge(defaults, target.macros); | ||
@@ -36,5 +39,5 @@ // Duplicates the template into the outputFile. | ||
for(let macro of Object.keys(target.macros)) { | ||
for(let macro of Object.keys(macros)) { | ||
let replacement = target.macros[macro]; | ||
let replacement = macros[macro]; | ||
@@ -41,0 +44,0 @@ // If there is environment specific replacement? |
{ | ||
"name": "ember-cli-multi-html-output", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "This addon lets you, at the end of the application build, override and/or duplicate and then patch the generated `index.html`, with values you configure in the application options. The values replace placeholders set into `app/index.html`.", | ||
@@ -14,3 +14,7 @@ "main": "index.js", | ||
"license": "ISC", | ||
"repository": "https://github.com/morgaan/ember-cli-multi-html-output" | ||
"repository": "https://github.com/morgaan/ember-cli-multi-html-output", | ||
"devDependencies": { | ||
"merge-obj": "0.0.3", | ||
"shelljs": "^0.7.8" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # ember-cli-multi-html-output | ||
Sometimes, because of running the same instance of the application under different domains and/or under several environment (e.g. `development`, `staging`, `production`), you need some texts, scripts ids... to be set for the targeted domain/environment. | ||
Sometimes, because of running the same instance of the application under different domains and/or under several environments (e.g. `development`, `staging`, `production`), you need some texts, scripts ids... to be set for the targeted domain/environment. | ||
@@ -24,12 +24,20 @@ This addon lets you, at the end of the application build, override and/or duplicate and then patch the generated `index.html`, with values you configure in the application options. | ||
multiIndex : { | ||
defaults: { | ||
'LOCALE_LANGUAGE': 'de', | ||
'LOCALE_COUNTRY': 'DE', | ||
'LOCALE_TLD': 'de' | ||
'SOME_TEXT': { | ||
'default': 'Some default text for dev' | ||
} | ||
}, | ||
targets: [ | ||
{ | ||
outputPath: 'index.html', | ||
macros: { | ||
'LOCALE_LANGUAGE': 'de', | ||
'LOCALE_COUNTRY': 'DE', | ||
'LOCALE_TLD': 'de', | ||
macros: { | ||
'PAGE_TITLE': { | ||
'default': 'My dev german app', | ||
'default': 'My dev german app', | ||
'production': 'My prod german app', | ||
}, | ||
'SOME_TEXT': { | ||
'production': 'Some text for german prod' | ||
} | ||
@@ -40,3 +48,3 @@ } | ||
outputPath: 'index-fr.html', | ||
macros: { | ||
macros: { | ||
'LOCALE_LANGUAGE': 'fr', | ||
@@ -46,4 +54,8 @@ 'LOCALE_COUNTRY': 'FR', | ||
'PAGE_TITLE': { | ||
'default': 'My dev french app', | ||
'default': 'My dev french app', | ||
'production': 'My prod french app', | ||
}, | ||
'SOME_TEXT': { | ||
'default': 'Some text for french dev' | ||
'production': 'Some text for french prod' | ||
} | ||
@@ -66,2 +78,3 @@ } | ||
<body data-language="LOCALE_LANGUAGE" data-country="LOCALE_COUNTRY" data-tld="LOCALE_TLD"> | ||
<p>SOME_TEXT</p> | ||
</body> | ||
@@ -81,2 +94,3 @@ </html> | ||
<body data-language="de" data-country="DE" data-tld="de"> | ||
<p>Some default text for german prod</p> | ||
</body> | ||
@@ -94,2 +108,3 @@ </html> | ||
<body data-language="fr" data-country="FR" data-tld="fr"> | ||
<p>Some default text for french prod</p> | ||
</body> | ||
@@ -99,3 +114,13 @@ </html> | ||
The `index-fr.html` for build `-env development` look like below: | ||
```html | ||
<!DOCTYPE html> | ||
<html lang="fr"> | ||
<head> | ||
<title>My dev french app</title> | ||
</head> | ||
<body data-language="fr" data-country="FR" data-tld="fr"> | ||
<p>Some default text for french dev</p> | ||
</body> | ||
</html> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17769
5
45
119
2
1