2

当我grunt build的 AngularJS 应用程序grunt-rev在处理字体时出现问题。它会很好地创建字体文件夹,但不会在其中放置任何字体。这是它向我展示的内容。

Running "rev:dist" (rev) task dist/scripts/scripts.js >> a3e641ec.scripts.js dist/styles/main.css >> 970b8797.main.css Warning: Unable to read "dist/fonts/Aller" file (Error code: EISDIR). Use --force to continue.

grunt-rev在我的Gruntfile.js

rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    }

如何解决这个问题?

4

2 回答 2

14

我终于通过使用双星号**方法递归匹配所有子目录解决了这个问题。我不知道为什么在我原来的Gruntfile.js中没有使用该方法。相反,它使用了{,*/}*由于某种原因没有递归行为的 。所以这是我的Gruntfile.jsrev中的新对象

rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/**/*.js',
            '<%= yeoman.dist %>/styles/**/*.css',
            '<%= yeoman.dist %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/fonts/**/*.ttf'
          ]
        }
      }
    },
于 2013-08-20T21:30:27.060 回答
1

我遇到了同样的问题。他们在 0.1.0 版本中有一个关于它的错误

一种解决方法是指定文件扩展名。

前:

rev: {
  dist: {
    files: [{
      expand: true,
      cwd: '<%= config.dist %>/',
      src: [
        'images/**/*'
      ]
    }]
  }
}

后:

rev: {
  dist: {
    files: [{
      expand: true,
      cwd: '<%= config.dist %>/',
      src: [
        'images/**/*.{gif,jpeg,jpg,png}'
      ]
    }]
  }
}
于 2015-03-04T20:00:51.030 回答