Hello, sass-spritemaker!
52
.eslintrc.json
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"no-undef": "error",
|
||||
"quotes": [
|
||||
2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}
|
||||
],
|
||||
"no-unused-vars": [0],
|
||||
"no-console": [2],
|
||||
"no-empty": ["error", {"allowEmptyCatch": true}],
|
||||
"array-bracket-spacing": ["error", "never"],
|
||||
"block-spacing": ["error", "always"],
|
||||
"brace-style": ["error", "1tbs", {"allowSingleLine": true}],
|
||||
"camelcase": ["error", {"properties": "never"}],
|
||||
"comma-dangle": ["error", "never"],
|
||||
"comma-spacing": ["error", {"before": false, "after": true}],
|
||||
"comma-style": ["error", "last"],
|
||||
"computed-property-spacing": ["error", "never"],
|
||||
"key-spacing": [
|
||||
"error", {"beforeColon": false, "afterColon": true, "mode": "strict"}
|
||||
],
|
||||
"keyword-spacing": ["error", { "before": true, "after": true }],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"max-len": ["error", 120],
|
||||
"no-multiple-empty-lines": ["error"],
|
||||
"no-spaced-func": ["error"],
|
||||
"no-trailing-spaces": ["error"],
|
||||
"no-unreachable": [1],
|
||||
"no-whitespace-before-property": ["error"],
|
||||
"object-curly-spacing": ["error", "never"],
|
||||
"one-var-declaration-per-line": ["error", "always"],
|
||||
"one-var": ["error", "never"],
|
||||
"semi-spacing": ["error", {"before": false, "after": true}],
|
||||
"semi": ["error", "always"],
|
||||
"space-before-function-paren": ["error", "always"],
|
||||
"space-before-blocks": ["error", "always"],
|
||||
"space-in-parens": ["error", "never"],
|
||||
"space-infix-ops": ["error"],
|
||||
"unicode-bom": ["error", "never"]
|
||||
}
|
||||
}
|
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
example/.sass-cache/
|
||||
example/output/sprite*
|
||||
node_modules/
|
||||
tmp_spritemaker*/
|
||||
bthlabs-sass-spritemaker-*.tgz
|
5
.npmignore
Normal file
|
@ -0,0 +1,5 @@
|
|||
example/**/*
|
||||
test/**/*
|
||||
yarn.lock
|
||||
.eslintrc.json
|
||||
bthlabs-sass-spritemaker-*.tgz
|
19
LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2019-present Tomek Wójcik <contact@bthlabs.pl>
|
||||
|
||||
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.
|
29
NOTICE.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
sass-spritemaker
|
||||
Copyright (c) 2019-present Tomek Wójcik <contact@bthlabs.pl>
|
||||
|
||||
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.
|
||||
|
||||
---
|
||||
|
||||
sass-spritemaker includes the following third party software and resources
|
||||
|
||||
Linea Iconset
|
||||
Copyright (c) Dario Ferrando
|
||||
Licensed under terms of CCBY license
|
||||
http://creativecommons.org/licenses/by/4.0/
|
67
README.md
Normal file
|
@ -0,0 +1,67 @@
|
|||
# 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 you’re using [npm](http://npmjs.com/) package manager.
|
||||
sass-spritemaker supports [yarn](https://yarnpkg.com/), too.
|
||||
|
||||
## Usage example
|
||||
|
||||
The following JavaScript code demonstrates the most common usage of the
|
||||
library:
|
||||
|
||||
```javascript
|
||||
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](https://www.bthlabs.pl/).
|
||||
|
||||
## License
|
||||
|
||||
sass-spritemaker is licensed under the MIT License.
|
28
example/example.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright (c) 2019-present Tomek Wójcik <contact@bthlabs.pl>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
const {spritemaker} = require('../lib/spritemaker.js');
|
||||
|
||||
spritemaker({
|
||||
files: ['./icons/*.png'],
|
||||
output: './output/'
|
||||
});
|
BIN
example/icons/basic_accelerator.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
example/icons/basic_alarm.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/icons/basic_anchor.png
Normal file
After Width: | Height: | Size: 824 B |
BIN
example/icons/basic_anticlockwise.png
Normal file
After Width: | Height: | Size: 964 B |
BIN
example/icons/basic_archive.png
Normal file
After Width: | Height: | Size: 741 B |
BIN
example/icons/basic_archive_full.png
Normal file
After Width: | Height: | Size: 782 B |
BIN
example/icons/basic_ban.png
Normal file
After Width: | Height: | Size: 952 B |
BIN
example/icons/basic_battery_charge.png
Normal file
After Width: | Height: | Size: 464 B |
BIN
example/icons/basic_battery_empty.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
example/icons/basic_battery_full.png
Normal file
After Width: | Height: | Size: 287 B |
BIN
example/icons/basic_battery_half.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
example/icons/basic_bolt.png
Normal file
After Width: | Height: | Size: 962 B |
BIN
example/icons/basic_book.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
example/icons/basic_book_pen.png
Normal file
After Width: | Height: | Size: 406 B |
BIN
example/icons/basic_book_pencil.png
Normal file
After Width: | Height: | Size: 389 B |
BIN
example/icons/basic_bookmark.png
Normal file
After Width: | Height: | Size: 400 B |
BIN
example/icons/basic_calculator.png
Normal file
After Width: | Height: | Size: 462 B |
BIN
example/icons/basic_calendar.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
example/icons/basic_cards_diamonds.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/icons/basic_cards_hearts.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/icons/basic_case.png
Normal file
After Width: | Height: | Size: 413 B |
BIN
example/icons/basic_chronometer.png
Normal file
After Width: | Height: | Size: 923 B |
BIN
example/icons/basic_clessidre.png
Normal file
After Width: | Height: | Size: 543 B |
BIN
example/icons/basic_clock.png
Normal file
After Width: | Height: | Size: 943 B |
BIN
example/icons/basic_clockwise.png
Normal file
After Width: | Height: | Size: 963 B |
BIN
example/icons/basic_cloud.png
Normal file
After Width: | Height: | Size: 770 B |
BIN
example/icons/basic_clubs.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/icons/basic_compass.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/icons/basic_cup.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
example/icons/basic_diamonds.png
Normal file
After Width: | Height: | Size: 597 B |
BIN
example/icons/basic_display.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
example/icons/basic_download.png
Normal file
After Width: | Height: | Size: 410 B |
BIN
example/icons/basic_exclamation.png
Normal file
After Width: | Height: | Size: 821 B |
BIN
example/icons/basic_eye.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
example/icons/basic_eye_closed.png
Normal file
After Width: | Height: | Size: 892 B |
BIN
example/icons/basic_female.png
Normal file
After Width: | Height: | Size: 885 B |
BIN
example/icons/basic_flag1.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
example/icons/basic_flag2.png
Normal file
After Width: | Height: | Size: 446 B |
BIN
example/icons/basic_floppydisk.png
Normal file
After Width: | Height: | Size: 425 B |
BIN
example/icons/basic_folder.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
example/icons/basic_folder_multiple.png
Normal file
After Width: | Height: | Size: 385 B |
BIN
example/icons/basic_gear.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
example/icons/basic_geolocalize-01.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
example/icons/basic_geolocalize-05.png
Normal file
After Width: | Height: | Size: 935 B |
BIN
example/icons/basic_globe.png
Normal file
After Width: | Height: | Size: 895 B |
BIN
example/icons/basic_gunsight.png
Normal file
After Width: | Height: | Size: 753 B |
BIN
example/icons/basic_hammer.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
example/icons/basic_headset.png
Normal file
After Width: | Height: | Size: 836 B |
BIN
example/icons/basic_heart.png
Normal file
After Width: | Height: | Size: 961 B |
BIN
example/icons/basic_heart_broken.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
example/icons/basic_helm.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
example/icons/basic_home.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
example/icons/basic_info.png
Normal file
After Width: | Height: | Size: 824 B |
BIN
example/icons/basic_ipod.png
Normal file
After Width: | Height: | Size: 552 B |
BIN
example/icons/basic_joypad.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
example/icons/basic_key.png
Normal file
After Width: | Height: | Size: 553 B |
BIN
example/icons/basic_keyboard.png
Normal file
After Width: | Height: | Size: 304 B |
BIN
example/icons/basic_laptop.png
Normal file
After Width: | Height: | Size: 275 B |
BIN
example/icons/basic_life_buoy.png
Normal file
After Width: | Height: | Size: 921 B |
BIN
example/icons/basic_lightbulb.png
Normal file
After Width: | Height: | Size: 993 B |
BIN
example/icons/basic_link.png
Normal file
After Width: | Height: | Size: 843 B |
BIN
example/icons/basic_lock.png
Normal file
After Width: | Height: | Size: 621 B |
BIN
example/icons/basic_lock_open.png
Normal file
After Width: | Height: | Size: 627 B |
BIN
example/icons/basic_magic_mouse.png
Normal file
After Width: | Height: | Size: 579 B |
BIN
example/icons/basic_magnifier.png
Normal file
After Width: | Height: | Size: 816 B |
BIN
example/icons/basic_magnifier_minus.png
Normal file
After Width: | Height: | Size: 828 B |
BIN
example/icons/basic_magnifier_plus.png
Normal file
After Width: | Height: | Size: 845 B |
BIN
example/icons/basic_mail.png
Normal file
After Width: | Height: | Size: 514 B |
BIN
example/icons/basic_mail_multiple.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
example/icons/basic_mail_open.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
example/icons/basic_mail_open_text.png
Normal file
After Width: | Height: | Size: 664 B |
BIN
example/icons/basic_male.png
Normal file
After Width: | Height: | Size: 850 B |
BIN
example/icons/basic_map.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
example/icons/basic_message.png
Normal file
After Width: | Height: | Size: 439 B |
BIN
example/icons/basic_message_multiple.png
Normal file
After Width: | Height: | Size: 440 B |
BIN
example/icons/basic_message_txt.png
Normal file
After Width: | Height: | Size: 456 B |
BIN
example/icons/basic_mixer2.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
example/icons/basic_mouse.png
Normal file
After Width: | Height: | Size: 655 B |
BIN
example/icons/basic_notebook.png
Normal file
After Width: | Height: | Size: 286 B |
BIN
example/icons/basic_notebook_pen.png
Normal file
After Width: | Height: | Size: 442 B |
BIN
example/icons/basic_notebook_pencil.png
Normal file
After Width: | Height: | Size: 414 B |
BIN
example/icons/basic_paperplane.png
Normal file
After Width: | Height: | Size: 1014 B |
BIN
example/icons/basic_pencil_ruler.png
Normal file
After Width: | Height: | Size: 627 B |
BIN
example/icons/basic_pencil_ruler_pen .png
Normal file
After Width: | Height: | Size: 548 B |
BIN
example/icons/basic_photo.png
Normal file
After Width: | Height: | Size: 570 B |
BIN
example/icons/basic_picture.png
Normal file
After Width: | Height: | Size: 711 B |
BIN
example/icons/basic_picture_multiple.png
Normal file
After Width: | Height: | Size: 717 B |
BIN
example/icons/basic_pin1.png
Normal file
After Width: | Height: | Size: 656 B |
BIN
example/icons/basic_pin2.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
example/icons/basic_postcard.png
Normal file
After Width: | Height: | Size: 301 B |
BIN
example/icons/basic_postcard_multiple.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
example/icons/basic_printer.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
example/icons/basic_question.png
Normal file
After Width: | Height: | Size: 1010 B |