【问题标题】:Adding the uri.js bower component breaks my Grunfile.js, which dies thinking the uri.js directory is a file. How to fix?添加 uri.js bower 组件会破坏我的 Grunfile.js,它认为 uri.js 目录是一个文件而死。怎么修?
【发布时间】:2015-06-13 17:20:55
【问题描述】:

Yeoman 生成的 Gruntfile.js 在 grunt 构建期间死亡:

Running "rev:dist" (rev) task
dist/public/app/app.js >> b90d2f58.app.js
dist/public/app/vendor.js >> 2deb5480.vendor.js
Warning: Unable to read "dist/public/bower_components/uri.js" file (Error code: EISDIR). Used --force, continuing.

显然它将 uri.js 组件目录解释为一个文件!一个简单的解决方法是将 uri.js 组件重命名为 uri_js 或类似名称。但是,与其这样做,是否有一个简单的开关可以添加到执行散列以知道“uri.js”不是文件的实用程序中???我已经尝试将“过滤器:'isFile'”添加到 Gruntfile 中以 *.js 作为模式的每个位置,但无济于事。

任何已经看到此内容的人,感谢您的帮助。现在我只是在做 grunt build --force。谢谢

【问题讨论】:

    标签: build gruntjs uri bower yo


    【解决方案1】:

    我终于发现可以将此 bower_component 从重命名过程中排除。关键是 rev 片段中文件的顺序取决于选择的顺序。所以我修改了我的 Gruntfile.js 的这一部分……一切都很好。

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/public/{,*/}*.js',
            '<%= yeoman.dist %>/public/{,*/}*.css',
            '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/public/assets/fonts/*',
            '!<%= yeoman.dist %>/public/bower_components/uri.js'
          ]
        }
      }
    

    关键的补充是最后一段:

            '!<%= yeoman.dist %>/public/bower_components/uri.js'
    

    我希望这可以帮助其他人解决这个问题!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-26
      • 2015-10-07
      • 2011-03-25
      • 2011-08-19
      • 1970-01-01
      • 2017-12-04
      • 1970-01-01
      • 2017-02-02
      相关资源
      最近更新 更多