Skip to content

Support for importing from npm packages: @import (npm) ... #1965

Closed

Description

@andreypopp

I want to propose a new feature which would allow to import less/css files from inside npm packages using Node module resolution algorithm (e.g. searching package inside node_modules directory in the current directory and up the tree, see Node docs for more details).

The syntax I propose is:

@import (npm) ...

which naturally extends import options available today. I think it would be nice to have npm import option to be compatible with other options such as reference, inline and so on.

The motivation for this is simple — browserify+npm become more and more popular for developing browser applications in a modular fashion. I think it would be nice to have the same degree of modularity when writing stylesheets with less.

For the reference, there's already an implementation of @import (npm) .... I think having this in core would enable much more straightforward usage and will allow to keep this feature in sync with less development.

Activity

  1. lukeapage commented on Apr 11, 2014

    @lukeapage
    Member

    I would welcome this being implemented as a plugin to begin with.

  2. andreypopp commented on Apr 11, 2014

    @andreypopp
    Author

    @lukeapage does less have plugin API?

  3. jfsiii commented on Apr 23, 2014

    @jfsiii

    @lukeapage I would like to add support for bower as well. Should I create a similar PR or a plugin? If plugin, can you link to docs or an existing example?

  4. jfsiii commented on Apr 23, 2014

    @jfsiii

    @lukeapage nevermind, I found #1861

  5. lukeapage commented on May 4, 2014

    @lukeapage
    Member

    As I said on the pull request id rather npm:// and bower:// as it is environment specific not less language specific. It also means plugins just need to handle the filename, not edit the parser behaviour.

  6. lukeapage commented on May 4, 2014

    @lukeapage
    Member

    Also have a look at the 2.0 pull request.

  7. hojberg commented on Aug 26, 2014

    @hojberg

    and progress on this? Would really like this feature!

  8. seven-phases-max commented on Aug 26, 2014

    @seven-phases-max
    Member

    @hojberg See related discussion in #1972. (I.e. most likely not in The Core but in a plugin when v2.0 comes out (if someone writes such plugin of course)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions