1

是否有配置 Bower.json 的最佳实践,以便在不同区域设置开发文件和生产文件并与 WireDep 等工具很好地配合使用?

我正在将这个 Angular 插件用于谷歌地方Kuhnza/Angular-Google-Places-Autocomplete

该项目的 Bower.json 在主要数据结构中列出了原始文件和缩小文件。

鲍尔.json

{
  "name": "angular-google-places-autocomplete",
  "version": "0.2.7",
  "main": [
      "./src/autocomplete.js",
      "./src/autocomplete.css",
      "./dist/autocomplete.min.js",
      "./dist/autocomplete.min.css"
  ],
  "dependencies": {
    "angular": "^1.2.x"
  },
  "devDependencies": {
    "angular-mocks": "^1.2.x"
  },
  "ignore": []
}

当我运行wiredep 任务时,它在我的Index.html 中包含缩小文件和原始文件

/ ------------------------------------------------------------------------------------------
// Wire Dependenciews from root bower.json in the index.html, e.g. Inject bower components
// ------------------------------------------------------------------------------------------
gulp.task('wiredep', function () {
    var wiredep = require('wiredep').stream;

    gulp.src('app/styles/*.scss')
      .pipe(wiredep({
          ignorePath: /^(\.\.\/)+/
      }))
      .pipe(gulp.dest('app/styles'));

    gulp.src('app/*.html')
      .pipe(wiredep({
          exclude: ['bootstrap-sass-official'],
          ignorePath: /^(\.\.\/)*\.\./
      }))
      .pipe(gulp.dest('app'));
});

生成的输出

<script src="/bower_components/angular-google-places-autocomplete/src/autocomplete.js"></script>
<script src="/bower_components/angular-google-places-autocomplete/dist/autocomplete.min.js"></script>
4

0 回答 0