gulp-sprite-glue plugin for gulp
This plugin requires
First, install gulp-sprite-glue
as a development dependency:
npm install --save-dev gulp-sprite-glue
Then, add it to your gulpfile.js
:
var glue = require("gulp-sprite-glue");
gulp.src("./src/*")
.pipe(glue("/path/to/sprites",{
// options
}));
//glue("dest path",options);
or
var glue = require("gulp-sprite-glue");
gulp.src("./src/*")
.pipe(glue({
css: '/path/to/css_dest',
img: '/path/to/img_dest'
}));
//glue(options);
//Both css and img options required.
Type: Boolean
Default value: false
Optimize our sprite by croping all the unnecessary transparent spaces that the original images could have.
Type: Boolean
Default value: false
Generate both a sprite image and a caat metadata file.
Type: Boolean
Default value: false
Automatically add the hash of the PNG file to the CSS url
Type: String
Default value: null
Insted of using the hash of the PNG as a queryarg it uses it as part of the filename.
Type: Boolean
Default value: false
Only apply filename cachebusting to the sprite image and not to both the CSS and the sprite image.
Type: Boolean
Default value: false
Generate both a sprite image and a xml metadata file compatible with cocos2d.
Type: String
Default value: null
Choose an individual folder for css you.
Type: String
Default value: null
Choose an individual folder for image.
Type: String
Default value: null
You can use your own css template
Type: Boolean
Default value: false
In order to avoid this behaviour you can use force and glue will always build the sprites.
Type: Boolean
Default value: false
Follow symbolic links.
Type: Boolean
Default value: false
Generate a test html per sprite using all the available CSS classes. This option is only useful for testing purposes.
Type: Boolean
Default value: false
Generate both a sprite image and a json metadata file.
Type: String
Default value: null
You can customize how the generated JSON will look. You can choose between array and hash.
Type: Boolean
Default value: false
Glue can also create .less files
Type: String
Default value: null
You can use your own less template
Type: Number
Default value: null
If you want to spread the images around the sprite but you don’t want to count this space as image width/height.
Type: String
Default value: null
your own namespace you can override the default one.
Type: Boolean
Default value: false
Don’t create any sprite image.
Type: Boolean
Default value: false
Don’t create any CSS file.
Type: String
Default value: null
Before processing the images using the algorithm glue orders the images.
- maxside
- width
- height
- area
- filename
Type: Number
Default value: null
If you want to add the same padding around all images.
Type: Boolean
Default value: false
By using the flag png8 the output image format will be png8 instead of png32.
Type: Boolean
Default value: false
Generate several sprites for a project.
Type: String
Default value: null
using the filename of the source images you can customize the pseudo class related to the images.
Type: Boolean
Default value: false
This flag will make glue suppress all console output.
Type: Boolean
Default value: false
Read directories recursively and add all the images to the same sprite.
Type: String
Default value: null
Automatically scale down your sprites to automatically fit them into low-dpi devices.
Type: Boolean
Default value: false
The option retina is only a shortcut for ratios=2,1.
Type: String
Default value: null
Source directory.
Type: String
Default value: null
Output directory.
Type: Boolean
Default value: false
Glue can also create .scss files.
Type: String
Default value: null
You can use your own scss template
Type: String
Default value: null
Separator for the CSS class names.
Type: String
Default value: null
Sprite’s name as past of the CSS class namespace.
Type: String
Default value: null
PNG file name the relative url between the CSS and the PNG file.
Type: Boolean
Default value: false
While you are developing a site it could be quite frustrating running Glue.
npm test
MIT
Copyright (c) 2014 frontainer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.