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 - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

convert.js

31

index.js

@@ -5,2 +5,3 @@ 'use strict';

const fs = require('fs');
const convert = require('./convert');

@@ -39,26 +40,8 @@ const loader = function(content)

function jsToSass (obj) {
// Convert object root properties into sass variables
var sass = '';
for (var key in obj) {
sass += '$' + key + ':' + JSON.stringify(obj[key]) + ';\n';
}
// Store string values (so they remain unaffected)
var storedStrings = [];
sass = sass.replace(/(["'])(?:(?=(\\?))\2.)*?\1/g, function (str) {
var id = '___JTS' + storedStrings.length;
storedStrings.push({id: id, value: str});
return id;
});
// Convert js lists and objects into sass lists and maps
sass = sass.replace(/[{\[]/g, '(').replace(/[}\]]/g, ')');
// Put string values back (now that we're done converting)
// Remove quotes from the value
storedStrings.forEach(function (str) {
sass = sass.replace(str.id, str.value.replace(/['"]+/g, ''));
});
const opts = {
prefix: '$',
suffix: ';',
suffixLastItem: true,
};
var sass = convert(obj, opts);
return sass;

@@ -65,0 +48,0 @@ }

{
"name": "@epegzz/sass-vars-loader",
"version": "1.0.3",
"version": "1.1.0",
"author": "Daniel Schäfer <epegzz@gmail.com>",
"description": "A SASS vars loader for Webpack. Load global SASS vars from JS/JSON files or from Webpack config.",
"files": ["index.js"],
"files": [
"index.js",
"convert.js"
],
"dependencies": {

@@ -14,5 +17,19 @@ "loader-utils": "~0.2.11"

},
"scripts": {
"test": "jest",
"watch-test": "jest --watch"
},
"keywords": [
"scss", "sass", "js", "json", "vars", "variables", "webpack", "loader"
]
"scss",
"sass",
"js",
"json",
"vars",
"variables",
"webpack",
"loader"
],
"devDependencies": {
"jest": "^18.1.0"
}
}
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