Angular-cli: 'includePaths' does not work with LESS

Created on 21 Jul 2017  路  7Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.2.2
node: 6.11.0
os: linux x64

Repro steps.

  1. Create project with less styles ng new [NAME] --style=less
  2. Create styles/variables.less directory in src folder
  3. Update styles config in .angular-cli.json
"styles": [
    "styles/variables.less"
],
"stylePreprocessorOptions": {
    "includePaths": [
        "styles"
    ]
},
  1. Import variables in component styles
@import 'variables';

div {
    color: @text-color;
}

The log given by the failure.

ERROR in ./src/app/app.component.less
Module build failed:

@import 'variables';
^
Can't resolve './variables.less' in '/home/user/Desktop/ng-less/src/app'
      in /home/user/Desktop/ng-less/src/app/app.component.less (line 1, column 0)
 @ ./src/app/app.component.ts 18:17-48
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4242 ./src/main.ts

Desired functionality.

includePaths should work like less paths option

Mention any other details that might be useful.

The steps were reproduced with scss styles and it worked correctly

easy (hours) help wanted 2 (required) feature

All 7 comments

It was not included as it was blocked by https://github.com/webpack-contrib/less-loader/pull/75

Is there any workaround?

It becomes inconveniently to use relative imports in case of deep folder structure
(for example @import '../../../../../variables)

This is not a bug but a feature request. Less support was never included in the functionality (https://github.com/angular/angular-cli/pull/4003).

Now that it's possible, I'd like to integrate it. PRs are welcome, but bear in mind it should use the built-in LESS resolver and not the webpack resolver.

I could implement it.

@filipesilva shortly v1.3.0 was released, but it seems that the feature of #7212 is not inside of this release (I cross-checked it with the output in my local node_modules). Or are the releases not of the latest commit of the master?

@JPeer264 your PR was released in v1.4.0-beta.0 and up. We only add features to a version in -beta releases so it did not get into 1.3.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naveedahmed1 picture naveedahmed1  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

donaldallen picture donaldallen  路  3Comments