
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
postcss-advanced-variables
Advanced tools
PostCSS Advanced Variables lets you use Sass-like variables, conditionals, and iterators in CSS.
$dir: assets/icons;
@each $icon in (foo, bar, baz) {
.icon-$icon {
background: url('$dir/$icon.png');
}
}
@for $index from 1 to 5 by 2 {
.col-$index {
width: $(index)0%;
}
}
/* after */
.icon-foo {
background: url('assets/icons/foo.png');
}
.icon-bar {
background: url('assets/icons/bar.png');
}
.icon-baz {
background: url('assets/icons/baz.png');
}
.col-1 {
width: 10%;
}
.col-3 {
width: 30%;
}
.col-5 {
width: 50%;
}
Add PostCSS Advanced Variables to your build tool:
npm install postcss-advanced-variables --save-dev
Use PostCSS Advanced Variables to process your CSS:
require('postcss-advanced-variables').process(YOUR_CSS);
Add PostCSS to your build tool:
npm install postcss --save-dev
Use PostCSS Advanced Variables as a plugin:
postcss([
require('postcss-advanced-variables')(/* options */)
]).process(YOUR_CSS);
Add Gulp PostCSS to your build tool:
npm install gulp-postcss --save-dev
Use PostCSS Advanced Variables in your Gulpfile:
var postcss = require('gulp-postcss');
gulp.task('css', function () {
return gulp.src('./src/*.css').pipe(
postcss([
require('postcss-advanced-variables')(/* options */)
])
).pipe(
gulp.dest('.')
);
});
Add Grunt PostCSS to your build tool:
npm install grunt-postcss --save-dev
Use PostCSS Advanced Variables in your Gruntfile:
grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
postcss: {
options: {
use: [
require('postcss-advanced-variables')(/* options */)
]
},
dist: {
src: '*.css'
}
}
});
variables
The variables
option lets you specify your own global variables.
require('postcss-advanced-variables')({
variables: {
'site-width': '960px'
}
});
The variables
option also accepts a function, which will be given 2 arguments;
the name of the unresolved variable, and the PostCSS node that used it.
require('postcss-advanced-variables')({
variables(name, node) {
if (name === 'site-width') {
return '960px';
}
return undefined;
}
});
.hero {
max-width: $site-width;
}
/* after */
.hero {
max-width: 960px;
}
unresolved
The unresolved
option lets you determine how unresolved variables and mixins
should be handled. The available options are throw
, warn
, and ignore
. The
default option is to throw
.
require('postcss-advanced-variables')({
unresolved: 'ignore' // ignore unresolved variables
});
2.1.0 (January 1, 2018)
@mixin
, @include
, and @content
FAQs
Use Sass-like variables, conditionals, and iterators in CSS
The npm package postcss-advanced-variables receives a total of 107,667 weekly downloads. As such, postcss-advanced-variables popularity was classified as popular.
We found that postcss-advanced-variables demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.