JSPM

sass-module-resolve-importer

1.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q35033F
  • License MIT

Import Sass modules using (enhanced) Node resolve.

Package Exports

  • sass-module-resolve-importer
  • sass-module-resolve-importer/package.json

Readme

sass-module-resolve-importer

Build Status

Import Sass modules using (enhanced) Node resolve.

This allows you to load Sass modules which are installed through npm and are located in node_modules.

Resolver will look for modules using following package.json fields:

  • exports.sass
  • exports.style
  • exports.browser
  • exports.import
  • exports.require
  • exports.node
  • style
  • browser
  • module
  • main

⚠️ If found module is CSS file (has .css extension) and contains @import directives, it will be processed with PostCSS and postcss-import plugin (postcss-import-sync2 for synchronous mode). This is intentional since imports in classic CSS files can be handled in various ways, and Sass has rules for importing CSS and plain CSS @imports. You can avoid this behavior by using classic @import url(…).

Install

npm install sass-module-resolve-importer --save

Usage

import sass from 'sass';
import resolver from 'sass-module-resolve-importer';

sass.render({
    // …
    importer: [resolver()]
});

API

resolver()

Returns: sass.Importer

Sass importer function.

resolver().sync

Returns: sass.Importer

Synchronous Sass importer function.

License

MIT © Ivan Nikolić