A sass/scss style processor for sprity
- sprity version >= 1.0
Install with npm
npm install sprity sprity-sass --save
If you want to use sprity-sass
with the command line interface of sprity
install it globally.
npm install sprity sprity-sass -g
- style-type: Eighter scss or sass. Defaults to scss.
On commandline:
sprity out/ src/*.png -s style.scss -p sass --style-type scss
In JavaScript:
var sprite = require('sprity');
sprite.create({
...
style: 'style.scss',
processor: 'sass'
'style-type': 'scss'
...
}, function () {
console.log('done');
});
scss usage example
@import 'sprite'; // the generated style file (sprite.scss)
// camera icon (camera.png in src directory)
.icon-camera {
@include sprite($camera);
}
// cart icon (cart.png in src directory)
.icon-cart {
@include sprite($cart);
}
sass usage example
@import 'sprite' // the generated style file (sprite.sass)
// camera icon (camera.png in src directory)
.icon-camera
+sprite($camera)
// cart icon (cart.png in src directory)
.icon-cart
+sprite($cart)
See sprity documentation