javascript – Grunt有线,不会注入字体

前端之家收集整理的这篇文章主要介绍了javascript – Grunt有线,不会注入字体前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在开展一个已经开始使用yeoman的项目.

由于某些原因,当我运行grunt-wireep时,所有的依赖关系都注入到我的index.html中,除了font-awesome.

这是我的bower.json文件

{
  "name": "watermelon","version": "0.0.0","dependencies": {
    "angular": "^1.3.0","angular-animate": "^1.3.0","angular-bootstrap": "~0.13.3","angular-cookies": "^1.3.0","angular-google-maps-native": "~2.0.0","angular-mocks": "~1.3.0","angular-resource": "^1.3.0","angular-route": "^1.3.0","angular-sanitize": "^1.3.0","angular-scenario": "~1.3.0","angular-touch": "^1.3.0","angular-ui-router": "~0.2.15","bootstrap": "^3.2.0","bootstrap-switch": "~3.3.2","eonasdan-bootstrap-datetimepicker": "~4.15.35","es5-shim": "^4.0.0","font-awesome": "~4.4.0","json3": "^3.3.0","moment": "~2.10.6","ng-tags-input": "3.0.0","requirejs": "latest","requirejs-domready": "latest","stacktrace-js": "~0.6.4","underscore": "~1.8.3"
  },"appPath": "."
}

链接到Gruntfile.js:http://pastebin.com/xxZwAYRW

当我运行grunt-wireep只有这些css依赖注入:

<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" />
<link rel="stylesheet" href="bower_components/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="bower_components/ng-tags-input/ng-tags-input.min.css" />
<!-- endbower -->

解决方法

这个问题打破了 latest(4.4.0) commit to FontAwesome.

修复很简单.你需要设置一个覆盖(或者可能使用较少,但我不打算覆盖).

{
  "name": "myProject","dependencies": {
    "font-awesome": ">=4.4.0",},"overrides":{
    "font-awesome": {
    "main": [
        "css/font-awesome.css"
    ]
    }
  }
}

OR(因为fontawesome / font-awesome都注册了两个名称)

{
  "name": "myProject","dependencies": {
    "fontawesome": ">=4.4.0","overrides":{
    "fontawesome": {
    "main": [
        "css/font-awesome.css"
    ]
    }
  }
}

猜你在找的JavaScript相关文章