简体   繁体   中英

Ignore specific main files when using bower-installer

So I'm working on a yeoman generator and using bower-installer to install front-end dependancies.

Problem I am having is slick-carousel lists slick.css, slick.scss and slick.less as main files and I'm only after slick.scss.

So with bower-installer is there a way I can ignore the css and less files?

I've tried adding to the ignore array, with various different file paths but no luck.

Is it possible? and if so, how do I do it?

Thanks in advance.

FYI My bower file:

{
  "name": "project-name",
  "authors": [
    "Rawnet <development@rawnet.com>"
  ],
  "ignore": [
    "jquery"
  ],
  "install": {
    "path": "/ui/app/vendor",
    "ignore": [
      "jquery"
    ]
  },
  "overrides": {
    "slick": {
      "slick-carousel": ["slick.scss", "slick.js"]
    }
  },
  "dependencies": {
    "picturefill": "^3.0.2",
    "slick-carousel": "^1.6.0"
  }
}

The ignore option works differently as it makes other users install your project with bower ignore files. What you want is the override option, you may use it like this to override the main property of a certain bower.json file (you might need to adapt the package name and the path to slick.scss)

Edit: This belongs in YOUR bower.json file, where it should look like this:

{
  "name": "THE NAME OF YOUR PACKAGE",

  "overrides": {
    "slick": {
      "slick-carousel": ["slick.css"]
    }
  }
}

So I managed to get it working with sources, this is my new bower.json file:

{
  "name": "project-name",
  "authors": [
    "Rawnet <development@rawnet.com>"
  ],
  "ignore": [
    "jquery"
  ],
  "install": {
    "path": "/ui/app/vendor",
    "ignore": [
      "jquery"
    ],
    "sources": {
      "slick-carousel": ["bower_components/slick-carousel/slick/slick.scss", "bower_components/slick-carousel/slick/slick.js"]
    }
  },
  "dependencies": {
    "picturefill": "^3.0.2",
    "slick-carousel": "^1.6.0"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM