javascript – Grunt将一个点作为文件处理文件夹

当尝试编译我的grunt文件并构建到我的dist文件夹中进行部署时,我在控制台中收到以下错误
Running "rev:dist" (rev) task
dist/public/app/app.js >> 63decaf3.app.js
dist/public/app/vendor.js >> a09756ab.vendor.js
dist/public/app/app.css >> d2017fc8.app.css
Warning: Unable to read "dist/public/bower_components/animate.css" file (Error code: EISDIR).

原因是我已经安装了一个名为animate.css的bower组件.该库当然安装在我的bower_components文件夹中,但是我在Grunt文件中的匹配字符串只能查找扩展名为.js的文件,.css等.这是我匹配的字符串:

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

这里是目录结构:

bower_components
  -> ...
  -> angular-ui-router
  -> animate.css  // Folder with the error
  ---> animate.css  // File that it should be recognizing
  ---> animate.min.css  // File that it should be recognizing
  -> es5-shim
  -> ...

在这种情况下,我如何告诉Grunt这是一个包含文件而不是文件本身的目录?

解决方法

我有不同的做法.

bower安装animate-css –save

它会抓住animate.css,但保存在:

bower_components /动画-CSS

使用这种方法你不必玩Gruntfile.js,我个人认为不愉快的编辑,甚至看;)

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...