在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):weixin/gulp-lazyimagecss开源软件地址(OpenSource Url):https://github.com/weixin/gulp-lazyimagecss开源编程语言(OpenSource Language):JavaScript 78.1%开源软件介绍(OpenSource Introduction):gulp-lazyimagecss
NPM Home Page: https://www.npmjs.com/package/gulp-lazyimagecss InstallInstall with NPM: npm install gulp-lazyimagecss --save Usagegulpfile.js var lazyimagecss = require('gulp-lazyimagecss');
gulp.src(paths.src.less)
.pipe(less())
.pipe(lazyimagecss())
.pipe(gulp.dest(paths.src.css));
Options options = lodash.extend({
width: true, // Output width in CSS
height: true, // Output height in CSS
backgroundSize: true, // Output background-size in CSS
imagePath: [] // Set image path to be worked (e.g. `['../slice','../img']`)
}, options); ResultCSS In .bg-test {
background: url(../img/bg.png);
background-repeat: no-repeat;
}
.icon-test {
background-image: url(../slice/test.png);
}
.icon-test-retina {
background-image: url(../slice/test@2x.png);
} CSS Out .bg-test {
background: url(../img/bg.png);
background-repeat: no-repeat;
width: 1100px;
height: 300px;
}
.icon-test {
background-image: url(../slice/test.png); // test.png - 32x32
width: 32px;
height: 32px;
}
.icon-test-retina {
background-image: url(../slice/test@2x.png); // test@2x.png - 64x64
width: 32px;
height: 32px;
background-size: 32px;
} Tips: Use PostCSS with Notes
ContributingThis repo is build and maintained by TmT Team. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论