2016-08-01 36 views
0

我已经使用Yeoman配置了我的Angular应用程序,并且包含了很多JS库(如d3)。当我使用grunt服务来查看应用程序时,该应用程序正常工作。但是当我尝试使用grunt build来构建它,并打开生成的index.html时,应用程序因为无法找到D3而中断。如果我手动包含脚本标记以在最终的index.html中加载D3,那么它开始工作,但这不是它应该如何工作的,对吧?grunt build从应用程序中删除d3.js和谷歌字体

咕噜打造还删除我已经包含在我的应用程序谷歌字体:

<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'> 

链接标签从最终的index.html

我bower.json长相失踪像这样:

{ 
    "name": "myApp", 
    "version": "0.0.0", 
    "main": "index.html", 
    "ignore": [ 
    "**/.*", 
    "node_modules", 
    "bower_components" 
    ], 
    "dependencies": { 
    "jquery": "~2.2", 
    "lodash": "~4.9", 
    "bootstrap": "^3.3.6", 
    "angular": "~1.5", 
    "angular-route": "~1.5", 
    "angular-animate": "~1.5", 
    "angular-resource": "~1.5", 
    "angular-cookies": "^1.5.7", 
    "angular-mocks": "~1.5", 
    "angular-bootstrap": "~1.3.1", 
    "moment": "~2.12", 
    "less.js": "~2.6", 
    "font-awesome": "~4.5", 
    "d3": "^3.5.17" 
    } 
} 

我还没有测试与其他库的问题,因为他们可能会所以在构建之后不能工作。然而,angular,bootstrap,font-awesome和LESS工作正常。这真让我抓狂!

回答

0

我注意到我在gruntfile中使用了dom_munger任务。它使用data-concat =“false”删除了所有脚本。

D3脚本被删除,因为它指定了data-concat =“false”。

现在问题已解决。

相关问题