
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
sass-all-variable-loader
Advanced tools
Loads sass files and extracts all variable declarations including from the imported sass files.
Loads sass files and extracts all variable declarations including from the imported sass files.
This webpack loader helps to get variable values from the SASS file in the JavaScript file as a JSON object with the property names corresponding to variable names.
$ npm install --save-dev sass-all-variable-loader
$ yarn add sass-all-variable-loader -D
It's better to create a SASS file which imports all variable declaration
files you need. For example, variables.scss
:
@import "./common-variables";
@import "./bootstrap-variables";
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
Suppose bootstrap-variables.scss declares variables as follows:
$gray-800: #29363d;
$body-color: $gray-800;
Then declare a loader in your webpack config:
module.exports = {
module: {
rules: [
{
oneOf: [
{
test: /variables\.scss/,
use: [
'sass-all-variable-loader',
]
},
Important thing: this entry should be before any other .scss loaders.
Then you can import variables in your .js/.ts file:
import * as reactstrap from 'reactstrap';
import styled from 'styled-components';
const variables = require('../../scss/variables.scss');
export const Pimpochka = styled(reactstrap.Button)`
background-color: ${variables['$body-color']};
`;
If you don't want to declare a separate entry in webpack config, you can import the sass file with the exclamation mark syntax:
import variables from '!!sass-all-variable-loader!./_variables.scss';
However I don't recommend it because it is weird and it breaks navigation in your favorite IDE.
This loader was created because of critical limitations of similar ones out there. For example sass-variable-loader can't handle any multiline statements or declarations such as sass maps or functions. Even though this loader still has it's own limitations:
FAQs
Loads sass files and extracts all variable declarations including from the imported sass files.
The npm package sass-all-variable-loader receives a total of 83 weekly downloads. As such, sass-all-variable-loader popularity was classified as not popular.
We found that sass-all-variable-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.