1.0.6 • Published 9 years ago

consul-gulp-plugin v1.0.6

Weekly downloads
2
License
ISC
Repository
-
Last release
9 years ago

智课教育

服务小组技术支持

这是什么

这个可以用来将前端需要的配置在gulp打包的时候注入到需要渲染的html页面中

使用方法

这是一个gulp插件, 你可以在gulpfile.js中这样配置

-- index.html
<script type="text/javascript">
  window.CFG = {};
</script>
gulp.task('config', function() {
  gulp.src('src/tpl/index.html')
    .pipe(consulPlugin.config(/(window.CFG) = (.*)/, {
      host: 'http://127.0.0.1:9507',
      ci: '123',
      keys: ['optimus']
    }))
    .pipe(gulp.dest('src/tpl/'));
});

使用参数

  • rep: 需要替换的字符串/正则
  • host: 配置服务的ip+端口
  • ci: 权限验证字符串
  • keys: 前端需要使用的配置项的数组
  • env: 环境(默认:development)
1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago