Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including grunt-sass-tilde-importer with all npm packages installed. Try it out:

var gruntSassTildeImporter = require("grunt-sass-tilde-importer")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

grunt-sass-tilde-importer v1.0.2

Resolves paths starting with ~ inside the node_modules directory

Grunt Sass Tilde Importer

What you want to do

Import sass-stylesheets from a node module inside your application's scss file when using node-sass via grunt-sass.

What you would like to write

@import '~module_name/stylesheet';


@import '~bootstrap-sass/assets/stylesheets/_bootstrap';

with the bootstrap sass module.

What you have to do

Install this module with npm install --save-dev grunt-sass-tilde-importer and update your Gruntfile:

Require the module with tilde_importer = require('grunt-sass-tilde-importer'); and add importer: tilde_importer to the options of your grunt-sass-configuration.

Thanks go to Dominic Tobias who suggested this solution.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free