How to include all .less files in the angular-cli.json styles section?

So the problem is that every time I create a new component, I have to remember that it adds its .less

stylesheet to the file angular-cli.json

. I would really like if I somehow told angular to just rebuild all files .less

wherever they are. I tried to do something like this:

{
    "apps": [
        {
            ...
            "styles": [
                "**/*.less"
            ],
            ...
        }
    ]
}

      

But i get

module not found error

Any help?

+3


source to share


1 answer


every time i create a new component i have to remember to add it .less stylesheet to angular-cli.json

Not necessary.

Components are imported to app.module.ts and also added to imports[]

.

angular-cli.json only include global.less style styles and stylesheets from npm packages.

it will be added automatically when installing the package via npm



If the default extension is at least,

in angular-cli.json, in below code

"defaults": {
    "styleExt": "css",
    "component": {}
}

      

replace css with less than

"defaults": {
    "styleExt": "less",
    "component": {}
}

      

0


source







All Articles