Socket
Socket
Sign inDemoInstall

css-sprite

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-sprite - npm Package Compare versions

Comparing version 0.9.6 to 0.9.7

5

bin/cli.js

@@ -76,2 +76,7 @@ #!/usr/bin/env node

})
.option('interpolation', {
choices: ['nearest-neighbor', 'moving-average', 'linear', 'grid', 'cubic', 'lanczos'],
dedault: 'grid',
help: 'Interpolation algorithm used when scaling retina images (nearest-neighbor|moving-average|linear|grid|cubic|lanczos)'
})
.option('opacity', {

@@ -78,0 +83,0 @@ default: 0,

5

lib/css-sprite.js

@@ -14,2 +14,3 @@ 'use strict';

var Color = require('color');
var url = require('url');

@@ -114,3 +115,3 @@ // json2css template

type: 'retina',
image: (!opt.base64) ? path.join(opt.cssPath, retinaSprite.relative).replace(/\\/g, '/') : 'data:' + imageinfo(retinaSprite.buffer).mimeType + ';base64,' + retinaSprite.buffer.toString('base64'),
image: (!opt.base64) ? url.resolve(opt.cssPath.replace(/\\/g, '/'), retinaSprite.relative) : 'data:' + imageinfo(retinaSprite.buffer).mimeType + ';base64,' + retinaSprite.buffer.toString('base64'),
total_width: sprite.canvas.width(),

@@ -131,3 +132,3 @@ total_height: sprite.canvas.height()

type: 'sprite',
image: (!opt.base64) ? path.join(opt.cssPath, sprite.relative).replace(/\\/g, '/') : 'data:' + imageinfo(sprite.buffer).mimeType + ';base64,' + sprite.buffer.toString('base64'),
image: (!opt.base64) ? url.resolve(opt.cssPath.replace(/\\/g, '/'), sprite.relative) : 'data:' + imageinfo(sprite.buffer).mimeType + ';base64,' + sprite.buffer.toString('base64'),
total_width: sprite.canvas.width,

@@ -134,0 +135,0 @@ total_height: sprite.canvas.height

2

package.json
{
"name": "css-sprite",
"version": "0.9.6",
"version": "0.9.7",
"description": "css sprite generator",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -40,17 +40,18 @@ # css-sprite

Options:
-b, --base64 create css with base64 encoded sprite (css file will be written to <out>)
-c, --css-image-path http path to images on the web server (relative to css path or absolute path) [../images]
-f, --format output format of the sprite (png or jpg) [png]
-n, --name name of sprite file without file extension [sprite]
-p, --processor output format of the css. one of css, less, sass, scss or stylus [css]
-t, --template output template file, overrides processor option
-r, --retina generate both retina and standard sprites. src images have to be in retina resolution (doubled dimensions, with even-numbered height and width)
-s, --style file to write css to, if omitted no css is written
-w, --watch continuously create sprite
--background background color of the sprite in hex [#FFFFFF]
--margin margin in px between tiles [4]
--opacity background opacity of the sprite. defaults to 0 when png or 100 when jpg [0]
--orientation orientation of the sprite image (vertical|horizontal|binary-tree) [vertical]
--prefix prefix for the class name used in css (without .)
--no-sort disable sorting of layout
-b, --base64 create css with base64 encoded sprite (css file will be written to <out>)
-c, --css-image-path http path to images on the web server (relative to css path or absolute path) [../images]
-f, --format output format of the sprite (png or jpg) [png]
-n, --name name of sprite file without file extension [sprite]
-p, --processor output format of the css. one of css, less, sass, scss or stylus [css]
-t, --template output template file, overrides processor option
-r, --retina generate both retina and standard sprites. src images have to be in retina resolution
-s, --style file to write css to, if omitted no css is written
-w, --watch continuously create sprite
--background background color of the sprite in hex [#FFFFFF]
--margin margin in px between tiles [4]
--interpolation Interpolation algorithm used when scaling retina images (nearest-neighbor|moving-average|linear|grid|cubic|lanczos)
--opacity background opacity of the sprite. defaults to 0 when png or 100 when jpg [0]
--orientation orientation of the sprite image (vertical|horizontal|binary-tree) [vertical]
--prefix prefix for the class name used in css (without .)
--no-sort disable sorting of layout
```

@@ -57,0 +58,0 @@

@@ -216,2 +216,26 @@ 'use strict';

});
it('should return a css file with an absolute background img URL, if applicable', function (done) {
var css;
vfs.src('./test/fixtures/**')
.pipe(sprite({
out: './dist/img',
name: 'sprites',
style: './dist/css/sprites.css',
cssPath: 'http://foo.bar'
}))
.pipe(through2.obj(function (file, enc, cb) {
if (file.relative.indexOf('css') > -1) {
css = file;
}
cb();
}))
.on('data', noop)
.on('end', function () {
css.should.be.ok;
css.path.should.equal('./dist/css/sprites.css');
css.relative.should.equal('sprites.css');
css.contents.toString('utf-8').should.containEql('background-image: url(\'http://foo.bar/sprites.png\')');
done();
});
});
it('should return a object stream with a sprite and a scss file', function (done) {

@@ -218,0 +242,0 @@ var png, css;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc