当试图编译我的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这是一个包含文件而不是文件本身的目录?
When trying to compile my grunt file and build into my dist folder for deployment I get the following error in the console:
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).The reason for this is that I have a bower component I've got installed named animate.css. This library is of course installed in my bower_components folder, but the matching string I have in my Grunt file only looks for files with an extension of .js, .css, et cetera. Here's my matching string:
// 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/*' ] } } }And here's the directory structure:
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 -> ...In this case, how would I tell Grunt that this is a directory which contains files rather than a file itself?
最满意答案
我有一些不同的方法。
bower install animate-css --save
它会抓住animate.css,但保存在:
bower_components/animate-css
使用这种方法,你不必使用Gruntfile.js,我个人认为它不适合编辑,甚至看;)
I have slightly different approach.
bower install animate-css --save
it will grab animate.css but save at:
bower_components/animate-css
Using this method you don't have to play with Gruntfile.js which I personally consider unpleasant to edit and even look at ;)
更多推荐
发布评论