grunt-montage
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "grunt-montage", | ||
"description": "Generate CSS sprite sheets and the corresponding stylesheet", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "James Allardice", |
@@ -61,2 +61,8 @@ # montage | ||
#### options.magick | ||
Type: `Object` | ||
Default value: `undefined` | ||
A map of [command-line options for the ImageMagick montage tool](http://www.imagemagick.org/script/montage.php). | ||
### Usage Examples | ||
@@ -103,3 +109,27 @@ | ||
In this example, custom options are used to pass extra configuration through to ImageMagick. It will generate the same sprite sheet as the previous example, but with a transparent background. | ||
```js | ||
grunt.initConfig({ | ||
montage: { | ||
simple: { | ||
files: { | ||
"assets/sprites": [ | ||
"images/icons/*.png" | ||
] | ||
}, | ||
options: { | ||
size: 32, | ||
outputImage: "sprites.png", | ||
outputStylesheet: "styles.css", | ||
magick: { | ||
background: "none" | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
``` | ||
## Contributing | ||
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). |
@@ -18,4 +18,13 @@ module.exports = function (grunt) { | ||
outputImage = options.outputImage || "montage.png", | ||
outputStylesheet = options.outputStylesheet || "montage.css"; | ||
outputStylesheet = options.outputStylesheet || "montage.css", | ||
cliOptions = ""; | ||
// Build ImageMagick montage option string | ||
options.magick = options.magick || {}; | ||
cliOptions = Object.keys(options.magick).map(function (option) { | ||
return "-" + option + " " + options.magick[option]; | ||
}).join(" "); | ||
console.log(cliOptions); | ||
// Iterate over all specified file groups. | ||
@@ -63,3 +72,3 @@ this.files.forEach(function (files) { | ||
// Execute the ImageMagick montage tool | ||
exec("montage -tile " + cols + "x -geometry " + size + "x" + size + " " + src.join(" ") + " " + dest, function (err) { | ||
exec("montage -tile " + cols + "x -geometry " + size + "x" + size + " " + cliOptions + " " + src.join(" ") + " " + dest, function (err) { | ||
done(); | ||
@@ -66,0 +75,0 @@ }); |
30115
139
133