微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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,我个人认为不愉快的编辑,甚至看;)

原文地址:https://www.jb51.cc/js/149911.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐