node-sass-magic-importer
Version:
Custom node-sass importer for selector specific imports, node importing, module importing, globbing support and importing files only once
17 lines (13 loc) • 536 B
text/typescript
import { IBuildIncludePaths } from '../interfaces/IBuildIncludePaths';
import { IPath } from '../interfaces/IPath';
export function buildIncludePathsFactory(
path: IPath,
): IBuildIncludePaths {
return (nodeSassIncludePaths: string, previouslyResolvedPath: string) => {
const includePaths = [];
if (path.isAbsolute(previouslyResolvedPath)) {
includePaths.push(path.dirname(previouslyResolvedPath));
}
return [...new Set([...includePaths, ...nodeSassIncludePaths.split(path.delimiter)])] as string[];
};
}