This repository was archived by the owner on Jan 9, 2019. It is now read-only.
This repository was 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
Description
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.
- Add the missing import directives (reference, inline, once)
- 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
Metadata
Metadata
Assignees
Labels
No labels