grunt-envpreprocess
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "grunt-envpreprocess", | ||
"description": "A task for replacing environment-specific variables in a specified file or directory. Environment variables are specified in an external .json file.", | ||
"version": "0.1.0", | ||
"version": "0.1.01", | ||
"homepage": "https://github.com/ejfrancis/grunt-envpreprocess", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -11,3 +11,3 @@ # envpreprocess | ||
```shell | ||
npm install envpreprocess --save-dev | ||
npm install grunt-envpreprocess --save-dev | ||
``` | ||
@@ -18,8 +18,7 @@ | ||
```js | ||
grunt.loadNpmTasks('envpreprocess'); | ||
grunt.loadNpmTask('grunt-envpreprocess'); | ||
``` | ||
## The "envpreprocess" task | ||
## The grunt-envpreprocess task | ||
Text search and replacement in files is powered by the core of [grunt-text-replace](https://github.com/yoniholmes/grunt-text-replace). | ||
### Overview | ||
@@ -56,3 +55,3 @@ In your project's Gruntfile, add a section named `envpreprocess` to the data object passed into `grunt.initConfig()`. | ||
Reading ENV variables from config/env.json | ||
Replaced all ENV variables in dev_build/**/*.* | ||
Replaced all ENV variables in prod_build/**/*.* | ||
``` | ||
@@ -69,3 +68,3 @@ | ||
Type: `String` | ||
Default value: `dev'` | ||
Default value: `dev` | ||
@@ -78,2 +77,3 @@ Which environment to use when retrieving ENV variables from the .json file. If given "*", any environment that isn't specified will use that value. | ||
Environment variables are defined in the config file located at the specified 'files.src' file. For each variable you must define a value for each environment, or use "*" to apply it to any environments that don't have a value specified. This is an example of such file | ||
```json | ||
@@ -86,8 +86,8 @@ { | ||
"APP_VERSION": { | ||
"*" | ||
"*": "0.1.0" | ||
}, | ||
"API_BASE": { | ||
"dev": "http://localhost:8000", | ||
"prod": "https://www.mysite.com/api" | ||
} | ||
"API_BASE": { | ||
"dev": "http://localhost:8000", | ||
"prod": "https://www.mysite.com/api" | ||
} | ||
} | ||
@@ -110,3 +110,4 @@ ``` | ||
Which will produce | ||
If you run 'grunt envpreprocess' with options.environment="dev", it will produce | ||
```html | ||
@@ -124,2 +125,16 @@ <head> | ||
Similarly, if you run 'grunt envpreprocess' with options.environment="prod", it will produce | ||
```html | ||
<head> | ||
<title>AppProd</title> | ||
</head> | ||
<script src="https://www.mysite.com/api/user/create"> | ||
``` | ||
```js | ||
var version = "0.1.0"; | ||
alert(version); | ||
``` | ||
--- | ||
@@ -130,2 +145,2 @@ | ||
## Release History | ||
0.1.0 - Initial release. Functionality is working. Not tested. | ||
0.1.0 - Initial release. Functionality is working. Not tested. |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
18290
138
1