1
0
Convert a bunch of PNGs to a Sass spritemap.
Go to file
2019-01-10 09:21:09 +01:00
example Bunch of tweaks and fixes. 2019-01-10 09:21:09 +01:00
lib Bunch of tweaks and fixes. 2019-01-10 09:21:09 +01:00
test Bunch of tweaks and fixes. 2019-01-10 09:21:09 +01:00
.eslintrc.json Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
.gitignore Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
.npmignore Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
LICENSE Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
NOTICE.txt Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
package-lock.json Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
package.json Bunch of tweaks and fixes. 2019-01-10 09:21:09 +01:00
README.md Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00
yarn.lock Hello, sass-spritemaker! 2019-01-10 08:07:53 +01:00

sass-spritemaker

Convert a bunch of PNGs to a Sass spritemap.

Installation

sass-spritemaker requires Node 6.9.0 or later.

npm install --save-dev @bthlabs/sass-spritemaker

This assumes that youre using npm package manager. sass-spritemaker supports yarn, too.

Usage example

The following JavaScript code demonstrates the most common usage of the library:

const {spritemaker} = require('../lib/spritemaker.js');

spritemaker({
  files: ['./icons/*.png'],
  output: './output/'
});

API

spritemaker(options)

This is the main entrypoint of the library. The options argument is an object that specifies the function's behaviour.

Options object fields:

  • fields - array of globs that will be resolved to construct input files list. Defaults to [].
  • output - path to output directory. Defaults to sprite/.
  • urlPrefix - URL prefix for background image URLs. Defaults to /.

Development

To bootstrap the development environment, clone the repo and run npm install from the root directory.

The package.json file provides the following scripts:

  • lint - performs an eslint run over the source code,
  • test - performs a single test run.

Contributing

If you think you found a bug or want to send a patch, feel free to contact me through e-mail.

If you're sending a patch, make sure it passes eslint checks and is tested.

Author

sass-spritemaker is developed by Tomek Wójcik.

License

sass-spritemaker is licensed under the MIT License.