Skip to content

Import resolver fails with Tailwind import to layer #13645

Open
@jmooring

Description

@jmooring

Reference: https://discourse.gohugo.io/t/54483/2

The specific failing example from the topic above is:

@import "path" layer(layer-name);

But per MDN all of these are valid:

@import url;
@import url layer;
@import url layer(layer-name);
@import url layer(layer-name) supports(supports-condition);
@import url layer(layer-name) supports(supports-condition) list-of-media-queries;
@import url layer(layer-name) list-of-media-queries;
@import url supports(supports-condition);
@import url supports(supports-condition) list-of-media-queries;
@import url list-of-media-queries;

Where url can take the form "path" or url("something");, using either single or double quotes.

It seems like we should extract the path starting with the first single- or double quote, and ending with the next singe- or double-quote, ignoring the form url("something");.

shouldImportRe = regexp.MustCompile(`^@import ["'](.*?)["'];?\s*(/\*.*\*/)?$`)

path := strings.Trim(strings.TrimPrefix(line, importIdentifier), " \"';")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions