凉亭或咕噜不断从index.html中删除jquery [英] bower or grunt keeps removing jquery from index.html
问题描述
bower list
正确报告jquery 2.1.0正式更新。
我运行 bower install --save jquery
更新为
$ b
jquery# 2.1.0
作为依赖项,而
bower.json
文件现在可以正确列出jquery,并将所需版本作为依赖项:
{
name:xxx,
version:0.0.0,
dependencies:{
...
angular:1.2.13,
jquery:〜2.1.0,
sizzle:1.10.16,
bootstrap:〜3.0.3,
...
但每次运行 grunt build
或 grunt serve
时,<$ c从 index.html $ c中删除了$ c>< script src =bower_components / jquery / dist / jquery.js>< / script>
$ C>阻止整个应用程序运行。
#> grunt serve
运行serve任务
运行clean:server(clean)任务
清理.tmp ...确定
运行 bower-install:app(bower-install)任务
jquery没有被注入到你的文件中。
请查看app / bower_components / jquery文件,然后手动将其包含在您的文件中。
运行并发:服务器(并发)任务
...
手动添加它并不能解决任何问题。我完全被卡住了。必须有一些我做错的事情,但我一直在b my我的头很长一段时间,而完全没有生产力。谢谢。
这里有一个很长的答案,但我只有时间做一个短的,我想我可能会好的,而不是没有!
bower-install
是一项任务,它依赖Bower包正确指定 main
属性在 bower.json
中。最近的一些东西已经用jQuery Bower包进行了处理,它不再指定这个属性。如果没有, grunt-bower-install
也无能为力。
解决方法是手动将该引用在您的HTML中的<! - bower:js - ><! - endbower - >
块以外的jQuery。
抱歉,无奈。希望jQuery能尽快修复它的bower.json。
This is driving me crazy. So far Bower+Grunt (via Yeoman) has been a major source of frustration and a waste of time. All I want is my app to use the latest (2.1.0) version of jquery.
bower list
correctly reported jquery 2.1.0 as an official update.
I ran bower install --save jquery
to update to the last version, which it did.
The bower list
command now correctly reports jquery#2.1.0
as a dependency, and
the bower.json
file now correctly lists jquery with the wanted version as a dependency:
{
"name": "xxx",
"version": "0.0.0",
"dependencies": {
...
"angular": "1.2.13",
"jquery": "~2.1.0",
"sizzle": "1.10.16",
"bootstrap": "~3.0.3",
...
But every time I run grunt build
or grunt serve
the <script src="bower_components/jquery/dist/jquery.js"></script>
list gets removed from index.html
, preventing the entire app from functioning.
#> grunt serve
Running "serve" task
Running "clean:server" (clean) task
Cleaning .tmp...OK
Running "bower-install:app" (bower-install) task
jquery was not injected in your file.
Please go take a look in "app/bower_components/jquery" for the file you need, then manually include it in your file.
Running "concurrent:server" (concurrent) task
...
Adding it manually doesn't solve anything. I'm completely stuck. There must be something I am doing wrong but I've been banging my head for a long time while being completely unproductive. Thank you.
There's a long answer here, but I only have time for a short one, and I figured I might as well give that instead of nothing!
bower-install
is a task that depends on Bower packages properly specifying a main
property inside of their bower.json
. Some recent stuff has gone on with the jQuery Bower package, and it no longer specifies this property. Without, grunt-bower-install
can't help much.
The solution is to manually include that reference to jQuery outside of the <!-- bower:js --><!-- endbower -->
block in your HTML.
Sorry for the frustration. Hopefully, jQuery will fix its bower.json soon.
这篇关于凉亭或咕噜不断从index.html中删除jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!