我想安装modernizr,所以:
bower install modernizr
一切似乎都很好,但是当我检查 bower_components/modernizr 时,我看不到任何地方(甚至没有子目录)modernizr.js 或任何具有 Modernizr.js 内容的文件...
如果我安装 jQuery,请注意类似的问题
bower install jquery
bower“说”它已经安装了 jQuery 2.1.1,但我在任何地方都找不到它。 “dist”目录只有 jquery.min.map
如果相反,我需要 jQuery 最新的 1.X
bower install jquery#^1
我进入了 dist jquery.js 等。
为什么我经历了这一切?因为本来想安装yeoman webapp
yo webapp
并继续选择所有内容(sass、bootstrap 和 modernizr)。但是当我去运行它时
grunt serve
我懂了:
Running "serve" task
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "wiredep:app" (wiredep) task
app/index.html modified.
modernizr was not injected in your file.
Please go take a look in "C:\mobapps_html5\Working\bower_components\modernizr" f
or the file you need, then manually include it in your file.
Running "wiredep:sass" (wiredep) task
app/styles/main.scss modified.
modernizr was not injected in your file.
Please go take a look in "C:\mobapps_html5\Working\bower_components\modernizr" f
or the file you need, then manually include it in your file.
Running "concurrent:server" (concurrent) task
Running "copy:styles" (copy) task
Done, without errors.
Running "sass:server" (sass) task
File .tmp/styles/main.css created.
File .tmp/styles/main.css.map created.
Done, without errors.
Running "autoprefixer:dist" (autoprefixer) task
File .tmp/styles/main.css created.
Running "connect:livereload" (connect) task
Started connect web server on http://localhost:9000
Running "watch" task
Waiting...
Modernizr 没有被注入(inject)(当然它不存在!!!)并且 jQuery 不起作用(index.html 中的链接没有指向任何东西...... jquery.js 不存在,与每个 Modernizr 相同)
最佳答案
当您从 bower 获得 Modernizr 时,您需要转到下载 Modernizr 的目录并运行 npm install。完成后,运行 grunt test,grunt 将在 modernizr 文件夹中创建一个 dist,其中包含一个 modernizr-build.js 文件。
关于node.js - bower 安装 Modernizr...modernizr.js 在哪里?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27302498/