Giter Site home page Giter Site logo

gulp-inline-template's Introduction

#gulp-sprite-generator2

对gulp-sprite-generator(https://www.npmjs.com/package/gulp-sprite-generator) 进行了扩展,支持了以下功能:

1.同时支持background 和 background-image

2.修改了对图片路径的判断,支持路径后面带?查询字符串

3.支持按css文件名生成多个雪碧图

4.自动给生成的雪碧图url后面加上 ?={md5}

Demo:

gulp.task('style',function(){
    var spriteOutput;
    spriteOutput = gulp.src(srcPath+'/css/**/*.@(less|css)')
    .pipe(less())
    .pipe(spriter({
        baseUrl: "./",
        spriteSheetName:"[name].sprite.png",//会自动把[name]替换成正在处理文件名
        spriteSheetPath: "../images/sprite",
        filter: [
            function(image) {
                return !(image.url.indexOf("?__sprite") === -1);  //只对?__sprite进行雪碧图合并
            }
        ]
        verbose:true
    }))

    spriteOutput.css.pipe(gulp.dest(distPath+'/css'));
    spriteOutput.img.pipe(gulp.dest(distPath+'/images/sprite'));
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.