Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Globbed files are not added to the import once filter #227

Open
kevinramharak opened this issue Apr 1, 2021 · 0 comments
Open

Globbed files are not added to the import once filter #227

kevinramharak opened this issue Apr 1, 2021 · 0 comments

Comments

@kevinramharak
Copy link

From what I can tell the following lines:
https://github.com/maoberlehner/node-sass-magic-importer/blob/master/packages/node-sass-magic-importer/src/index.ts#L125-L128

Do not store the imported files. dart-sass (not sure about node-sass does not seem to run imports recusivly (took me a few hours). This allows for possible duplicates when using globbing.

Is this intendend? It seems easy enough to fix with something like:

        if (globFilePaths) {
            const contents = globFilePaths
                .reduce((result, resolvedUrl) => {
                    const id = getStoreId(resolvedUrl, selectorFilters, nodeFilters);
                    if (!store.has(id)) {
                        console.log('including:  ', resolvedUrl);
                        store.add(id);
                        result.push(`@import '${filterPrefix}${resolvedUrl}';`);
                    } else {
                        console.log('discarding: ', resolvedUrl);
                    }
                    return result; 
                }, []).join('\n');
            return { contents };
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant