在angular-cli.json中指定样式的顺序

时间:2016-12-14 16:56:09

标签: angular angular-cli

我正在为Angular 2使用第三方库mydatepickerrange。在angular-cli-.json我正在加载这样的包:

    "packages": {
        ...
        "mydaterangepicker" :{
          "map" : "node_modules/mydaterangepicker",
          "defaultExtension": "js"
        }

我想在这个包之后加载我的style.css以覆盖它的样式。我不确定如何这样做,有没有人经历过类似的情况?以下是我目前的angular-cli.json

{
  "project": {
    "version": "1.0.0-beta.19-3",
    "name": "..."
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.css",
        "../node_modules/bootstrap/dist/css/bootstrap.min.css"
      ],
      "scripts": [],
      "environments": {
        "source": "environments/environment.ts",
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "addons": [],
  "packages": {
    "moment": {
      "map": "node_modules/moment/moment.js",
      "type": "cjs",
      "defaultExtension": "js"
    },
    "mydaterangepicker" :{
      "map" : "node_modules/mydaterangepicker",
      "defaultExtension": "js"
    }
  },
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "prefixInterfaces": false,
    "inline": {
      "style": false,
      "template": false
    },
    "spec": {
      "class": false,
      "component": true,
      "directive": true,
      "module": false,
      "pipe": true,
      "service": true
    }
  }
}

1 个答案:

答案 0 :(得分:4)

我在CLI v1.0.0-beta.26上遇到了同样的问题。我把" styles.css"最后在我的文件列表中,它工作。捆绑时必须有一些基本的订单要求......