gulp-env-loader
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -61,2 +61,3 @@ const through = require('through2') | ||
* @param {boolean} options.isVar - A flag indicating whether to replace variables in the file contents (default: true). | ||
* @param {Object} options.env - Additional Environment Variables | ||
* @return {Stream} - The transform stream. | ||
@@ -76,3 +77,3 @@ */ | ||
const contents = file.contents.toString(enc) | ||
const replacedContents = replaceContent(contents, env, options.isVar ?? true) | ||
const replacedContents = replaceContent(contents, Object.assign({}, env, options.env), options.isVar ?? true) | ||
file.contents = Buffer.from(replacedContents) | ||
@@ -79,0 +80,0 @@ } catch (err) { |
{ | ||
"name": "gulp-env-loader", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "A gulp plugin for loading environment variables and replacing them in the contents of files.", | ||
@@ -5,0 +5,0 @@ "main": "./libs/index.js", |
@@ -99,5 +99,5 @@ # gulp-env-loader | ||
If it is a string, it represents the configuration file path. If it is an object, it can contain the following properties: | ||
- `path`: Configuration file path, default is `.env` | ||
- `mode`: Environment mode name. | ||
- `modekey`: Environment mode key name, default is `mode` | ||
- `path` - (`string`) Configuration file path, default is `.env` | ||
- `mode` - (`string`) Environment mode name. | ||
- `modekey` - (`string`) Environment mode key name, default is `mode` | ||
@@ -111,3 +111,4 @@ | ||
- `isVar`: Replaces environment variables with their corresponding string representations (Single quotation marks). Default is `true`. | ||
- `isVar` - (`boolean`) Replaces environment variables with their corresponding string representations (Single quotation marks). Default is `true`. | ||
- `env` - (`object`) Additional Environment Variables. | ||
@@ -114,0 +115,0 @@ |
@@ -98,5 +98,5 @@ # gulp-env-loader | ||
如果是字符串,则表示配置文件路径。如果是对象,则可以包含以下属性: | ||
- `path` : 配置文件路径, 默认为 `.env` | ||
- `mode` : 环境模式名称。 | ||
- `modekey` : 环境模式键名, 默认为 `mode` | ||
- `path` - (`string`) 配置文件路径, 默认为 `.env` | ||
- `mode` - (`string`) 环境模式名称。 | ||
- `modekey` - (`string`) 环境模式键名, 默认为 `mode` | ||
@@ -109,6 +109,6 @@ | ||
创建一个 through2 流,用于替换文件内容中的环境变量。 | ||
- `isVar` : 将环境变量替换为对应值的字符串表示 (加单引号)。默认为 `true` | ||
- `isVar` - (`boolean`) 将环境变量替换为对应值的字符串表示 (加单引号)。默认为 `true` | ||
- `env` - (`object`) 额外的环境变量对象 | ||
## Thanks | ||
@@ -115,0 +115,0 @@ * [dotenv](https://www.npmjs.com/package/dotenv) |
@@ -23,2 +23,6 @@ /// <reference types="node" /> | ||
isVar?: boolean; | ||
/** | ||
* Additional environment variables | ||
*/ | ||
env?: object; | ||
} | ||
@@ -25,0 +29,0 @@ |
13812
171
119