
Research
/Security News
11 Malicious Go Packages Distribute Obfuscated Remote Payloads
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
postcss-filter-stream
Advanced tools
PostCSS plugin which allows you to blacklist files / folders that you don't want to process with a given PostCSS plugin.
PostCSS plugin which allows you to blacklist files / folders that you don't want to process with a given PostCSS plugin.
import gulp from 'gulp';
import postcss from 'gulp-postcss';
import reporter from 'postcss-reporter';
import scss from 'postcss-scss';
import colorguard from 'colorguard';
import filterStream from 'postcss-filter-stream';
const processors = [
// Ignore all files recursively in vendor folder.
filterStream('**/css/vendor/**', colorguard()),
reporter({ clearMessages: true })
];
gulp.task('css-lint', () => {
return gulp.src('src/css/**/*.scss')
.pipe(postcss(processors, { syntax: scss }))
});
npm install --save-dev postcss-filter-stream
filterStream(filter: string|Array<string>, postcssPlugin: Function)
The filter
argument accepts a glob string or an array of glob strings. Globbing patterns:
Please note the preceding **/
in the example. Use it if you don't want to specify the absolute path, that in my
case would be: '/Users/tsm/Sites/__projects/gulp-starter/src/css/vendor/**'
.
The postcssPlugin
argument is basically any PostCSS plugin you choose to use.
In the example you can see i do not want the colorguard
plugin to check my .scss
files in the css/vendor/
directory because i have Bootstrap, Font Awesome and other vendor
sass files i choosed to compile at runtime. Of course i want to ignore these files because it is not my code, not my responsibility.
Ignore all .scss
and .sass
files recursively in vendor folder.
filterStream('**/src/css/vendor/**/*.+(scss|sass)', postCssPlugin())
Ignore all files recursively in vendor and custom folders and _scaffolding.scss
in common folder.
filterStream([
'**/src/css/vendor/**',
'**/src/css/custom/**',
'**/src/common/css/_scaffolding.scss'
], postCssPlugin())
Ignore all .scss
and .sass
files in vendor folder but the _font-awesome.scss
file.
filterStream([
'**/src/css/vendor/*.+(scss|sass)',
'!**/src/css/vendor/_font-awesome.scss'
], postCssPlugin())
Imagine you want to use a PostCSS plugin but you have to ignore some files / folders and the plugin's API doesnt't
have support for that. What can you do? Probably use gulp-filter
to filter the stream and apply
.pipe(postcss(processors, { syntax: scss }))
only for the filtered files. Of course if you use multiple PostCSS
plugins that you want to run anyway you will have to restore the filtered stream and run postcss again
.pipe(postcss(processors-2, { syntax: scss }))
. This is why a plugin like this exists.
FAQs
PostCSS plugin which allows you to blacklist files / folders that you don't want to process with a given PostCSS plugin.
The npm package postcss-filter-stream receives a total of 113 weekly downloads. As such, postcss-filter-stream popularity was classified as not popular.
We found that postcss-filter-stream 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.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
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).