🚀 DAY 2 OF LAUNCH WEEK: Unify Your Security Stack with Socket Basics.Learn more →
Socket
Book a DemoInstallSign in
Socket

sass-var-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sass-var-loader

A custom variable loader for sass.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

sass-var-loader

A custom loader for Webpack that allows you to break the rules by providing sass variables on-the-fly in things like imports and url's.

All you need to do is provide your variable in ~~ like this: ~~myVar~~.

Install

npm install --save-dev sass-var-loader

Usage

In your Webpack config:

module.exports = {
  ...
  module: {
    loaders: [
      {
        test: /\.scss$/,
        loaders: ['style', 'css', 'sass', 'sass-var']
      }
    ]
  },
  sassVarLoader: {
      myVariable: 'newValue'
  }
};

Example

mysass.scss:

@import 'some/custom/~~theme~~/variable'

.cake {
    color: $magic;
}

And your ~~theme~~ will be replaced with the value you would like at runtime!

You can provide as many variables as you would like and sass-var-loader will do the magic for you.

FAQs

Package last updated on 24 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts