4

I'm using a third party library mydatepickerrange for Angular 2. In the angular-cli-.json i'm loading the package like this:

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

I would like to load my style.css after this package in order to override it's styles. I'm unsure of how to do so, has anyone had experienced a similiar situation? Here is my present angular-cli.json below:

{
  "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 Answer 1

6

I ran into the same issue on CLI v1.0.0-beta.26. I put the "styles.css" last in my list of files and it worked. There must be some underlying order requirement when bundling...

Sign up to request clarification or add additional context in comments.

1 Comment

I had to restart the "npm start" server

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.