Skip to content

Document how to map external less files #1493

Closed

Description

@thelgevold

I am requesting documentation on how to map to imported less files in the webpack version of CLI.

In the previous version there was a hook in angular-cli.builds.js to specify paths for the lessCompiler:

lessCompiler: {
      paths: ['node_modules/some-path/less']
    }

angular-cli.builds.js is no longer included in the version on master.

It works to specify less files in styleUrls, but I am not able to import other less files from my component less files.

Activity

  1. filipesilva commented on Jul 29, 2016

    @filipesilva
    Contributor

    Possibly related #1465

    I don't have an answer for this at the moment. @TheLarkInn can you advise if there's a solution right now?

  2. TheLarkInn commented on Jul 29, 2016

    @TheLarkInn
    Member

    Yeah its related overall. @thelgevold we need to make essentially a property that allows this for all the preprocessers we support (behind the scenes).

  3. thelgevold commented on Jul 29, 2016

    @thelgevold
    ContributorAuthor

    Thanks @TheLarkInn .
    I wonder if there might be a similar issue when dealing with paths in tsconfig.json.

    paths was added in TS 1.9 and is a way to create an alias to avoid long relative import paths.

    If I run tsc my code compiles, but during ng build I get module not found errors, so I suspect the paths have to be "ferried" into the webpack world somehow?

  4. sirajc commented on Jul 29, 2016

    @sirajc

    Maybe, mapping paths of tsconfig to resolve.alias of webpack

  5. clydin commented on Aug 4, 2016

    @clydin
    Member

    @thelgevold The webpack specific method is to prefix the name of the package with a ~.
    For example, @import "~some-path/less/file";
    This is probably not the long-term solution, but might get you up and running.

  6. TheLarkInn commented on Aug 4, 2016

    @TheLarkInn
    Member

    Yeah this is great in webpack land but not user land.

  7. clydin commented on Aug 4, 2016

    @clydin
    Member

    For sass/scss, there is https://github.com/lucasmotta/sass-module-importer. It supports reading a module's package.json which allows a simple @import "<package-name>". This would allow sass/scss to mimic the typescript workflow of npm install and import.

  8. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Aug 10, 2016
  9. filipesilva commented on Jan 8, 2017

    @filipesilva
    Contributor

    Supersedes by #1791, work in progress on #2747

  10. angular-automatic-lock-bot commented on Sep 6, 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 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenttype: RFC / discussion / question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions