Skip to content

Commit

Permalink
Merge branch 'Horttcore-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
jkphl committed Jun 18, 2014
2 parents 62b3454 + de6b3ea commit 498f8c5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ iconizr
* a single compact **SVG icon sprite**,
* optimized single **PNG icons** (optional),
* an optimized combined **PNG icon sprite**,
* corresponding **CSS stylesheets** in customizable formats (e.g. CSS, Sass, LESS etc.),
* corresponding **CSS stylesheets** in customizable formats (e.g. CSS, Sass, LESS, Stylus etc.),
* an **HTML fragment** including some JavaScript for asynchronously loading the most appropriate stylesheet flavour (depending on the client)
* and a couple of **HTML preview documents** (depending on the options you specified) for previewing and testing the different stylesheets (optional).

Expand Down Expand Up @@ -84,7 +84,7 @@ Iconizr.createIconKit('path/with/svg/images', 'css/output/directory', options, c
The `createIconKit()` method will refuse to run if you don't pass exactly four arguments:

1. A path to be used as the **input directory** containing the SVG images for sprite creation. A relative path refers to the current working directory.
2. A main / default **output directory**, used for creating the stylesheet resources (CSS / Sass / LESS etc. if activated and not specified otherwise; see the [svg-sprite rendering options](https://github.com/jkphl/svg-sprite/blob/master/README.md#rendering-configuration)) and serving as a base for the sprite subdirectory given by `spritedir` see ([svg-sprite configuration options](https://github.com/jkphl/svg-sprite#available-options)). A relative path refers to the current working directory.
2. A main / default **output directory**, used for creating the stylesheet resources (CSS / Sass / LESS / Stylus etc. if activated and not specified otherwise; see the [svg-sprite rendering options](https://github.com/jkphl/svg-sprite/blob/master/README.md#rendering-configuration)) and serving as a base for the sprite subdirectory given by `spritedir` see ([svg-sprite configuration options](https://github.com/jkphl/svg-sprite#available-options)). A relative path refers to the current working directory.
3. An object with [configuration options](#available-options) (for both [svg-sprite](https://github.com/jkphl/svg-sprite#available-options) and [iconizr specific](#available-options)). None of these options is mandatory, so you may pass an empty object `{}` here.
4. A callback to be run when the sprite creation has finished (with or without error).

Expand All @@ -97,7 +97,7 @@ Configuration

|Option |Description |
|:------------|:------------|
|render |Rendering configuration (output formats like CSS, Sass, LESS, HTML with inline SVG, etc.)|
|render |Rendering configuration (output formats like CSS, Sass, LESS, Stylus, HTML with inline SVG, etc.)|
|spritedir |Sprite subdirectory name [`"svg"`]|
|sprite |Sprite file name [`"sprite"`]|
|prefix |CSS selector prefix [`"svg"`]|
Expand Down Expand Up @@ -147,6 +147,9 @@ Besides this Node.js module there are several different versions of *iconizr*:
Release History
---------------

#### v0.2.2
* Added a Stylus output template ([#5](https://github.com/jkphl/node-iconizr/pull/5))

#### v0.2.1
* Fixed invalid `background-position` style in Sass / LESS templates ([#4](https://github.com/jkphl/node-iconizr/issues/4))

Expand All @@ -162,6 +165,12 @@ Release History
#### v0.1.0
* Initial release


Contributors
------------
* [Ralf Hortt](https://github.com/Horttcore)


Legal
-----
Copyright © 2014 Joschi Kuphal <[email protected]> / [@jkphl](https://twitter.com/jkphl)
Expand Down
6 changes: 3 additions & 3 deletions test/iconizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ describe('iconizr', function() {
});

describe('with valid, extended arguments', function() {
it('generates 51 files', function(done) {
it('generates 57 files', function(done) {
this.timeout(10000);
Iconizr.createIconKit(path.join(__dirname, 'files'), path.normalize(path.join(__dirname, '..', 'tmp', 'css')), {preview: 'preview', keep: true, render: {scss: '../sass/_icons', less: '../less/_icons'}, level: 0}, function(err, result){
Iconizr.createIconKit(path.join(__dirname, 'files'), path.normalize(path.join(__dirname, '..', 'tmp', 'css')), {preview: 'preview', keep: true, render: {scss: '../sass/_icons', less: '../less/_icons', styl: '../styl/_icons'}, level: 0}, function(err, result){
should(err).not.ok;
should(result).be.an.Object;
should(result).property('success', true);
should(result).property('length', 51);
should(result).property('length', 57);
done();
});
});
Expand Down
16 changes: 16 additions & 0 deletions tmpl/sprite.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{#common}}.{{/common}}{{^common}}${{/common}}{{prefix}}
background-repeat no-repeat{{#common}}
background-image url({{{sprite}}}){{/common}}

{{#svg}}{{#selector}}.{{expression}}{{^last}},{{/last}}
{{/selector}}{{#sprite}} background-position {{position}}{{^common}}
{{/common}}{{/sprite}}{{^common}} @extend ${{prefix}}
background-image url({{#sprite}}{{{sprite}}}{{/sprite}}{{^sprite}}{{#encode}}"{{{encoded}}}"{{/encode}}{{^encode}}{{{path}}}{{/encode}}{{/sprite}}){{/common}}
{{#dims}}{{#dimensions}}

{{#selector}}.{{expression}}{{^last}},{{/last}}
{{/selector}} width {{width}}px
height {{height}}px
{{/dimensions}}{{/dims}}

{{/svg}}

0 comments on commit 498f8c5

Please sign in to comment.