Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-envpreprocess

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-envpreprocess - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc