Skip to content
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
@JanThiel

Description

@JanThiel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions