当尝试编译我的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 -> ...
解决方法
我有不同的做法.
bower安装animate-css –save
它会抓住animate.css,但保存在:
bower_components /动画-CSS
使用这种方法你不必玩Gruntfile.js,我个人认为不愉快的编辑,甚至看;)