node-sass-import

Allows recursive import of SCSS components from local and/or node_modules directories using npm's module resolving algorithm

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
node-sass-import
17182.0.16 years ago8 years agoMinified + gzip package size for node-sass-import in KB

Readme

node-sass-import
!npmnpm-imagenpm-url !Build Statustravis-imagetravis-url !Coverage Statuscoveralls-imagecoveralls-url !js-standard-stylestandard-imagestandard-url
Allows recursive import of SCSS components from local and/or nodemodules directories using npm's module resolving algorithm. Without the need for tildes(~) to import from nodemodules. Allows usage of @import "some-sass-npm-module" akin to require("some-npm-module") in node.js

Install

$ npm install --save node-sass-import

Usage

Used in conjunction with node-sass. In a simple npm-only build setup, the example below in package.json should suffice.
{
  "name": "your-package",
  "description": "fun package",
  "main": "index.js",
  "scripts": {
    "build-css": "node-sass test.scss dist/test.css --importer node_modules/node-sass-import"
  }
}
You can now build your scss files as follows
$ npm run build-css

Example

@import in sass can now be used just like a require statement. The example below imports the main scss file from the newsapps-syles npm module. At build time, all @import statements will be resolved locally or like npm modules. Also includes import support for partial scss files e.g. partial.scss
@import "newsapps-styles";

.some-style {
  color: $primary-blue;
}

API

Version 2+ supports Node 6+ and npm 2+

License

2016 MIT © Emmanuel (Manny) Narh
()