Skip to content
This repository has been archived by the owner on Jan 9, 2019. It is now read-only.

LessSource.getImports() only returns imports with type (css), (less) or none set #60

Open
JanThiel opened this issue Sep 9, 2014 · 0 comments · May be fixed by #61
Open

LessSource.getImports() only returns imports with type (css), (less) or none set #60

JanThiel opened this issue Sep 9, 2014 · 0 comments · May be fixed by #61

Comments

@JanThiel
Copy link

JanThiel commented Sep 9, 2014

Hi,

I use the LessSource.getImports method to build up a dependency tree of Less files. Now I switched from Less 1.3.3

@import mixins.less

to Less 1.7

@import (reference) mixins.less

Sadly after this change those imports are not being recognized as Imports anymore.
This is due to the Regex Pattern defined in LessSource.java#45

    /**
     * The <code>Pattern</code> used to match imported files.
     */
    private static final Pattern IMPORT_PATTERN = Pattern.compile("^(?!\\s*//\\s*).*(@import\\s+(url\\(|\\((less|css)\\))?\\s*(\"|')(.+)\\s*(\"|')(\\))?(.*);).*$", MULTILINE);

There are to possibilities to solve this.

  1. Add the missing import directives (reference, inline, once)
  2. Add another function, that returns all "non standard" Imports (which would be: reference, inline, multiple). Anyway "once" would be still missing in the regular .getImports.

Personally, I would go for option 1, as it is - what I believe - is expected behaviour. An import is an import and should therefore be returned. Anyway you should then account for the "multiple" directive and only return the file once in the Map.

Brgds

Jan

@JanThiel JanThiel linked a pull request Sep 9, 2014 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant