Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@epegzz/sass-vars-loader

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@epegzz/sass-vars-loader

A SASS vars loader for Webpack. Load global SASS vars from JS/JSON files or from Webpack config.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-62.41%
Maintainers
1
Weekly downloads
 
Created
Source

A SASS vars loader for Webpack

Load global SASS vars from JS/JSON files or from Webpack config.

Install

npm install @epegzz/sass-vars-loader --save-dev

Usage with passing vars directly in webpack config

Simply pass the SASS vars as plain JS object to the sassVars config property:

// webpack.js
loader: ExtractTextPlugin.extract('style', 'css!sass!@epegzz/sass-vars-loader')
sassVars: {
  vars: {
    breakpoints: {
      small: '300px',
      medium: '600px'
    }
    colors: {
      error: 'red'; 
    }
  }
}

Usage with loading vars from JS or JSON files

Pass filenames as array to the sassVars config object:

// webpack.js
loader: ExtractTextPlugin.extract('style', 'css!sass!@epegzz/sass-vars-loader')
sassVars: {
  files: [
    path.resolve(__dirname, '/path/to/breakpoints.js'), // JS
    path.resolve(__dirname, '/path/to/colors.json'), // JSON
  ]
}

With breakpoints.js:

const breakpoints = {
  small: '300px',
  medium: '600px',
}
module.exports = { breakpoints };

And colors.json:

{
  "colors": {
    "error": "red"
  }  
}

This will result in the following SASS vars being available in all SASS files:

$breakpoints: (
  small: 300px,
  medium: 600px,
);

$colors: (
  error: red,
);

Acknowledgments

SASS var generator shamelessly copied from Kasu/jsonToSassVars.js

Keywords

FAQs

Package last updated on 22 Sep 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc