0.0.1 • Published 8 years ago

sass-npm-import v0.0.1

Weekly downloads
13
License
-
Repository
-
Last release
8 years ago

scss-npm-import

Simple importer for node-sass to import npm and bower modules.

Say good-bye to all the mess with relative paths on your Sass files.
You can now import your Sass/SCSS modules by referencing to the module name, like this:

@import "sass-easing";

And it is support use like webpack loader

@import "~sass-easing";

Just for comparison, look at this mess:

@import "node_modules/sass-easing/_easings.scss";

How-to

install

npm install sass-npm-import --save-dev

use the importer with node-sass >= v3.0.0

var sass = require('node-sass');
var moduleImporter = require('sass-npm-import');

sass.render({
  file: './source/css/app.scss',
  importer: moduleImporter()
}, cb);

use the importer with gulp-sass

var gulp = require('gulp');
var sass = require('gulp-sass');
var moduleImporter = require('sass-npm-import');

gulp.task('style', function() {
  return gulp.src('./source/css/app.scss')
    .pipe(sass({ importer: moduleImporter() }))
    .pipe(gulp.dest('./public/css'));
});

Options

You can pass any option supported by node-resolve directly, like this:

importer({ prefix: '~',extensions: ['.scss', '.sass', '.css']});

Tests

Use npm test to run the tests.

Issues

If you discover a bug,send email zhoujianlin8@gmail.com

MIT

thankyou for node-sass-import