node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »



imgs sprite

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-imgs-sprite --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


The "imgs_sprite" task


In your project's Gruntfile, add a section named imgs_sprite to the data object passed into grunt.initConfig().

    // Configuration to be run (and then tested). 
    imgs_sprite: {
        options: {
            // sprite背景图源文件夹,只有匹配此路径才会处理,默认 images/sprite/ 
            imagepath: 'test/images/',
            // 雪碧图输出目录,默认images/ 
            // 替换后背景路径,默认 ../images/ 
            // 个图片间间距,如果设置为奇数,会强制+1以保证生成的2x图片为偶数宽高,默认 0 
           files : [{
               // css文件源的文件夹 
               // 匹配规则 默认匹配源文件夹底下的所有css文件 
               // 导出css的路径