grunt-hellosprite
Version:
A grunt plugin to help front engineer creating css sprite.
53 lines (42 loc) • 1.5 kB
JavaScript
/*
* grunt-hellosprite
* https://github.com/meterscao/test
*
* Copyright (c) 2013 meters
* Licensed under the MIT license.
*/
;
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// 自动雪碧图
hellosprite: {
// This is are multitask, you can create multiple sprite generators buy copying all
// object with other name, see grunt.js docs for details
sprite: {
files: [
{
expand: true, //启用动态扩展
cwd: 'css', // css文件源的文件夹
src: ['icon.css'], // 匹配规则
dest: 'tmp/', //导出css和雪碧图的路径地址
ext: 'icon.sprite.css' // 导出的css名
}
],
// options
option: {
// OPTIONAL: Rendering engine: auto, canvas, gm
'engine': 'gm',
// OPTIONAL: Image placing algorithm: top-down, left-right, diagonal, alt-diagonal
'algorithm': 'binary-tree'
}
}
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-hellosprite');
// By default, lint and run all tests.
grunt.registerTask('default', ['hellosprite']);
};