Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
gulp-css-urlencode-inline-svgs
Advanced tools
Makes CSS-inlined data:image/xml+svg compatible with Firefox and IE
gulp-css-urlencode-inline-svgs
Data URIs make sprites easier. SVGs make resolution independence easier.
Putting them together seems like an obvious win. You might think that because
the contents of an SVG is just XML text, you could just paste them right into
your stylesheets! But the spec says that data:image/xml+svg
must be URL
encoded. So you still need to pass them through an encoding stage like you
would for base64'ing other image types.
Here's a gulp plugin that does that. It works on plain CSS so put it in your pipe after your compiler and autoprefixer, but before your minifier.
var urlencode = require('gulp-css-urlencode-inline-svgs');
gulp.task('styles', function () {
gulp.src('src/styles/index.scss')
.pipe(sass())
.pipe(prefix())
.pipe(urlencode()) // New hotness
.pipe(cssmin())
.pipe(gulp.dest('public'));
});
background-image: url('data:image/svg+xml;utf8, <svg version="1.1" ... etc
background-image: url('data:image/svg+xml;utf8, %3Csvg%20version%3D%22 ... etc
}\n
. Might want to provide a different one.FAQs
Makes CSS-inlined data:image/xml+svg compatible with Firefox and IE
The npm package gulp-css-urlencode-inline-svgs receives a total of 271 weekly downloads. As such, gulp-css-urlencode-inline-svgs popularity was classified as not popular.
We found that gulp-css-urlencode-inline-svgs 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.