Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
gulp-svg-to-css
Advanced tools
Plugin for gulp: Packs svg files in css sprite inline
npm install gulp-svg-to-css --save-dev
var svgToSss = require('gulp-svg-to-css');
gulp.src('**/*.svg')
.pipe(svgToSss('svg.css'))
.pipe(gulp.dest('build/'));
generated css:
.svg-filename,
.svg-filename-before:before,
.svg-filename-after:after{
background-image:url('data:image/svg+xml,data...')
}
.svg-filename2,
.svg-filename2-before:before,
.svg-filename2-after:after{
background-image:url('data:image/svg+xml,data...')
}
in html
<div class='svg-filename'>
as background-image for element
</div>
<div class='svg-filename-before'>
as background-image for :before pseudo-element
</div>
svgToSss({
name:'svg.css', // default 'svg.css'
prefix: 'ololo-', // default 'svg-'
postfix: '-trololo', // default ''
})
result css:
.ololo-filename-trololo,
.ololo-filename-trololo-before:before,
.ololo-filename-trololo-after:after{
background-image:url('data:image/svg+xml,data...')
}
This plugin use mustache template engine
default template:
.{{prefix}}{{filename}}{{postfix}},
.{{prefix}}{{filename}}{{postfix}}-before:before,
.{{prefix}}{{filename}}{{postfix}}-after:after{background-image:url('{{{dataurl}}}')}
custom template:
svgToSss({
template: "{{filename}} {{dataurl}} {{data}} {{prefix}} {{postfix}}"
})
svgToSss({
name: 'vars.styl',
template: "{{filename}} = '{{dataurl}}'"
})
.pipe(stylus())
result vars.styl:
filename1 = 'data:image/svg+xml,data...'
filename2 = 'data:image/svg+xml,data...'
filename3 = 'data:image/svg+xml,data...'
var svgToSss = require('gulp-svg-to-css');
var livereload = require('gulp-livereload');
var watch = require('gulp-watch');
gulp.task('svg', function(){
return gulp.src('**/*.svg')
.pipe(svgToSss('svg.css'))
.pipe(gulp.dest('build/'))
.pipe(livereload());
});
gulp.task('watch', function(){
livereload.listen();
watch('**/*.svg', function(){ gulp.start('svg') });
});
gulp.task('default', ['svg', 'watch']);
FAQs
Packs svg files in css sprite inline
The npm package gulp-svg-to-css receives a total of 6 weekly downloads. As such, gulp-svg-to-css popularity was classified as not popular.
We found that gulp-svg-to-css 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.