问题
I have a node_module https://github.com/Alberplz/angular2-color-picker that I am using in my angular 2 project, but as all modules it includes it's CSS files and if I do inspect element i see in listed as localhost, but can't actually locate where they are.
I could create a separate file and overwrite but than I making a bigger mess as putting CSS on top of CSS and I would like to re skin the module.
This is how the CSS looks now
Any suggestion?
回答1:
If you look into the repository of that project you can locate style here. The compiled style is imported to directive here. I don't see any example of changing color picker style other than this options.
If you want to override the style you might have to use some "shadow DOM breaking" solution or global style that will override it with more specific selector, eventually an !important
keyword.
回答2:
This component is extended in the ngx set of components (https://www.npmjs.com/package/ngx-color-pickerngx-color-picker) and I have been able to set styling by overriding style in a tag in the Index.html in Angular 5 application. The style tag must be below the body tag
回答3:
Basically the steps I understand to overwrite a module is to:
- Fork the github environment locally
- Git clone your forked enviorment
- Register on npm
- Apply changes to your local and publish on npm under different name
- Npm install the published npm pacakage.
来源:https://stackoverflow.com/questions/42893632/how-to-override-css-or-re-skin-for-node-module