Skip to content

'includePaths' does not work with LESS #7083

Closed

Description

@taras-d

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

Activity

  1. grizzm0 commented on Jul 21, 2017

    @grizzm0
    Contributor

    It was not included as it was blocked by webpack/less-loader#75

  2. taras-d commented on Jul 22, 2017

    @taras-d
    Author

    Is there any workaround?

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

  3. self-assigned this
    on Jul 31, 2017
  4. added
    featureLabel used to distinguish feature request from other issues
    help wantedLabel noting an issue which the team is looking for contribution from the community to fix
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Jul 31, 2017
  5. filipesilva commented on Jul 31, 2017

    @filipesilva
    Contributor

    This is not a bug but a feature request. Less support was never included in the functionality (#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.

  6. JPeer264 commented on Jul 31, 2017

    @JPeer264
    Contributor

    I could implement it.

  7. JPeer264 commented on Aug 10, 2017

    @JPeer264
    Contributor

    @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?

  8. filipesilva commented on Aug 21, 2017

    @filipesilva
    Contributor

    @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.

  9. added a commit that references this issue on Apr 23, 2018
    60ad834
  10. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  11. locked and limited conversation to collaborators on Sep 7, 2019
  12. added a commit that references this issue on May 29, 2026
    9bd7cc0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenteffort1: easy (hours)featureLabel used to distinguish feature request from other issueshelp wantedLabel noting an issue which the team is looking for contribution from the community to fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions