
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
gulp-tmtsprite
Advanced tools
Automatically generate sprites image and CSS.
(with retina @2x, @3x supported)
NPM Home Page: https://www.npmjs.com/package/gulp-tmtsprite
Install with NPM:
npm install gulp-tmtsprite --save
npm install gulp-if --save
gulpfile.js
var gulpif = require('gulp-if');
var tmtsprite = require('gulp-tmtsprite');
gulp.src('./src/css/style-*.css')
.pipe(tmtsprite())
.pipe(gulpif('*.png', gulp.dest('./dist/sprite/'), gulp.dest('./dist/css/')));
Options Custom your slice image path
var gulpif = require('gulp-if');
var tmtsprite = require('gulp-tmtsprite');
gulp.src('./src/css/style-*.css')
.pipe(tmtsprite({slicePath: '../slice'}))
.pipe(gulpif('*.png', gulp.dest('./dist/sprite/'), gulp.dest('./dist/css/')));
CSS In -> style-index.less
.icon-test {
width: 32px;
height: 32px;
background-image: url(../slice/test.png);
}
Tips: try gulp-LazyImageCSS if you are too lazy to type image width
/ height
and more.
CSS Out -> style-index.css
.icon-test {
background-image: url(../sprite/style-index.png);
}
// Retina 2x supported
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 2.5),
only screen and (min-resolution: 240dpi) {
.icon-test {
background-image:url("../sprite/style-index@2x.png");
background-position: -36px -66px;
background-size: 32px;
}
}
Tips: Retina 3x is ready based on image name, like icon-xxx@3x.png
with @3x
string inside.
Image In -> ./slice/*.png
Image Out -> ./sprite/style-index.png
Tips: 3x sprite is an option when needed.
24x26@2x.png
not 23x27@2x.png
FAQs
CSS Sprite Generator
We found that gulp-tmtsprite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.