Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foolishchow/gulp-configuration
use properties file config javascript
https://github.com/foolishchow/gulp-configuration
Last synced: 5 days ago
JSON representation
use properties file config javascript
- Host: GitHub
- URL: https://github.com/foolishchow/gulp-configuration
- Owner: foolishchow
- Created: 2016-02-18T11:56:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-17T04:47:07.000Z (over 7 years ago)
- Last Synced: 2024-11-01T18:03:52.585Z (13 days ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
gulp-configuration
----------
manage your `environment consts` in `.properties` files with `gulp`> useage
```shell
npm install gulp-configuration --save
```- in you `gulpfile.js`
```javascriptvar configration = require('gulp-configration');
gulp.task('configration',function(){
return gulp.src([
'src/main.js'
])
.pipe(configration('./vars/pre.vars.properties'))
.pipe(gulp.dest('../dist'));
});
```
- in your `src/main.js`
```javascript
window.configurations = {};
if( "${evn}".length == 3 ){
configurations = {
app_url : '${app_url}',
InterFaceIp:'${InterFaceIp}',
InterfaceUrl:'/Interface/core/postCtrl',
headpicPreffix: '${headpicPreffix}/Interface/upload/showImg?remoteFile=',
InterfaceName:'/Interface'
}
}else{
configurations = {
app_url: 'http://192.168.2.100:9300',
InterFaceIp: 'http://10.20.16.74:8282',
InterfaceUrl: '/Interface/core/postCtrl',
UploadInterfaceUrl: '/Interface/upload/file',
headpicPreffix: 'http://10.20.16.74:8282/Interface/attach/downloadFile?remoteFile=',
}
}
```- in your `vars/pre.vars.properties`
```
evn=pre
app_url=http://10.20.16.75:9300
InterFaceIp=http://10.20.16.75:8018
headpicPreffix=http://10.20.16.75:8018
```- after configuration , your `src/main.js` would be
```javascript
if( "pre".length == 3 ){
configurations = {
app_url : 'http://10.20.16.75:9300',
InterFaceIp:'http://10.20.16.75:8018',
InterfaceUrl:'/Interface/core/postCtrl',
headpicPreffix: 'http://10.20.16.75:8018/Interface/upload/showImg?remoteFile=',
InterfaceName:'/Interface'
}
}else{
configurations = {
app_url: 'http://192.168.2.100:9300',
InterFaceIp: 'http://10.20.16.74:8282',
InterfaceUrl: '/Interface/core/postCtrl',
UploadInterfaceUrl: '/Interface/upload/file',
headpicPreffix: 'http://10.20.16.74:8282/Interface/attach/downloadFile?remoteFile=',
}
}
```