Skip to content

davidkpiano/sassport-dynamic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sassport Dynamic Imports

Import dynamically in Sass using Sassport.

Quick Start

First, install Sassport and the Sassport-Dynamic module via NPM:

npm install sassport sassport-dynamic --save

Then, add any global $variables that you want to use in your imports to Sassport using .globals({...}):

var sassport = require('sassport');
var sassportDynamic = require('sassport-dynamic');

sassport([ sassportDynamic ])
  .globals({
    '$theme': 'material'
  })
  .render({
    file: 'main.scss'
  }, function(err, result) {
    // output result
  });

Any variables that you defined in .globals() will now be interpolated with the !dynamic loader:

// main.scss
@import 'themes/#{$theme} !dynamic';

This will output the same result as if you had @import 'themes/material';.

About

Dynamic imports for Node-Sass using Sassport

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published