
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
postcss-write-svg
Advanced tools
Write SVG lets you write SVGs directly in CSS.
/* before */
@svg square {
@rect {
fill: var(--color, black);
width: var(--size);
height: var(--size);
}
}
.example {
background: svg(square param(--color green) param(--size 100%)) center / cover;
}
/* after */
.example {
background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect fill='green' width='100%25' height='100%25'/%3E%3C/svg%3E") center / cover;
}
@svg at-rules generate SVG elements available to CSS. Within an @svg, descendant at-rules (like @rect) are interpreted as elements, while declarations (like width) are interpreted as attributes.
The svg() function renders an @svg as a data url(). var() functions within an @svg honor the variables passed in through param() functions.
utf8Type: Boolean
Default: true
Allows you to define whether UTF-8 or base64 encoding will be used.
/* before { utf8: false } */
@svg square {
@rect {
fill: black;
width: 100%;
height: 100%;
}
}
.example {
background: svg(square);
}
/* after */
.example {
background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IGZpbGw9ImJsYWNrIiB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIi8+PC9zdmc+");
}
Add Write SVG to your build tool:
npm install jonathantneal/postcss-write-svg --save-dev
require('postcss-write-svg').process(YOUR_CSS, { /* options */ });
Add PostCSS to your build tool:
npm install postcss --save-dev
Load Write SVG as a PostCSS plugin:
postcss([
require('postcss-write-svg')({ /* options */ })
]).process(YOUR_CSS, /* options */);
Add Gulp PostCSS to your build tool:
npm install gulp-postcss --save-dev
Enable Write SVG within your Gulpfile:
var postcss = require('gulp-postcss');
gulp.task('css', function () {
return gulp.src('./src/*.css').pipe(
postcss([
require('postcss-write-svg')({ /* options */ })
])
).pipe(
gulp.dest('.')
);
});
Add Grunt PostCSS to your build tool:
npm install grunt-postcss --save-dev
Enable Write SVG within your Gruntfile:
grunt.loadNpmTasks('grunt-postcss');
grunt.initConfig({
postcss: {
options: {
use: [
require('postcss-write-svg')({ /* options */ })
]
},
dist: {
src: '*.css'
}
}
});
3.0.1 (December 8, 2016)
FAQs
Write SVGs directly in CSS
We found that postcss-write-svg 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.