Giter Site home page Giter Site logo

jkphl / iconizr Goto Github PK

View Code? Open in Web Editor NEW
487.0 28.0 36.0 1.78 MB

A PHP command line tool for converting SVG images to a set of CSS icons (SVG & PNG, single icons and / or CSS sprites) with support for image optimization and Sass output. Created by Joschi Kuphal (@jkphl), licensed under the terms of the MIT license

Home Page: http://iconizr.com

License: MIT License

JavaScript 0.12% CSS 85.75% PHP 8.71% ApacheConf 0.01% HTML 5.42%

iconizr's Introduction

iconizr

iconizr

is an – at present: proof-of-concept – command line tool that helps you prepare your vector based SVG icons for use with the widest possible range of devices. It takes a folder of SVG files and processes them to a bunch of files including

To leverage iconizr to the greatest extent possible, some additional tools have to be installed on the system independently (see below).

iconizr is written in (namespaced) PHP and meant to be used on the (Linux) command line (i.e. with the PHP CLI SAPI). To be honest, there was only one reason making me go for PHP: It is what I know best. Im sure there are quite some other fancy modern languages and techniques one could use for achieving the same, but I guess I'm just not smart enough for those. Having said this, I'd welcome anyone contributing a port of iconizr.

Getting started

As iconizr is written in PHP, there's nothing much of an installation process. Just put the iconizr.phps script (along with it's accompanying files and directories) to a location of your liking and make sure that it may be executed by setting the proper file permissions. If you'd like to simplify the invocation of iconizr you might create a symlink into your local executables directory, e.g.:

ln -s /path/to/iconizr.phps /usr/local/bin/iconizr

Run iconizr by calling the script with the apropriate command line options (see below). Please consider that – for security reasons – the output directory has to be a sub(sub)directory of the current working directory, so change your working directory first if necessary:

cd /path/to/website/docroot
/path/to/iconizr.phps --css --out css source/svg

or using the symlink mentioned above:

iconizr --css --out css source/svg

This will take all the SVG files found in /path/to/website/docroot/source/svg and render the resulting CSS files and sprites to the directory /path/to/website/docroot/css (and below). For the sake of simplicity, Sass files have been omitted in this example.

Documentation

Usage:

iconizr [options] input/dir1 [input/dir2 ...]
Short Long Value Description
-o --out Directory path Provide the path of the output directory here. For security reasons, the output directory has to be a sub(sub)directory of the current working directory. If it doesn't exist, iconizr will try to create it. Along with the input directory this is a mandatory argument.
--sassout Directory path If you want the Sass files to be created in a separate directory, then specify it using this argument. The same restrictions apply as for the standard output directory. If you don't specify this argument, the Sass files will be created in the standard output directory.
-c --css String (optional) If this argument is given, several CSS files will be generated. By default, the filenames will all start with "iconizr" (e.g. "iconizr-svg-data.css"). If you provide a string value for this argument (e.g. "myproject"), this value will be used as the prefix for all generated CSS files (e.g. "myproject-svg-data.css").
-s --sass String (optional) Identical to the -c argument, but applying to the generation of Sass files.
-p --prefix String This is the prefix used for all CSS class names generated. It defaults to "icon", so that a SVG file named example.svg results in a CSS class named "icon-example".
-l --level Integer This is the optimization level for PNG files. It has to lie between 0 and 11 (inclusive) and defaults to 4, with 0 meaning "no optimization", 1 meaning "fast & rough" and 11 meaning "slow & high quality". Setting this to a high value may result in a very long processing time.
-q --quantize If given, iconizr will quantize PNG images (i.e. convert them to 8-bit color depth; please see the requirements for this). The quantized images are only used if they are smaller in file size than their the originals (and this is not necessarily the case for all PNG files). Quantization may also impact the visual image quality, so please make sure to compare the result to the original images.
-e --embed If given, iconizr will use this value as a prefix to the CSS directory path used to embed the stylesheets into your HTML documents (inside the JavaScript loader fragment). By default, the --out directory will be used as a root-relative path (i.e. giving path/to/css as --out directory will result in e.g. /path/to/css/weather-svg-sprite.css as CSS embed path). You may specify a period . here to make the embed path relative to your HTML document (i.e. ./path/to/css/weather-svg-sprite.css), or use any other arbitrary relative path (e.g. ../resources for the embed path ../resources/path/to/css/weather-svg-sprite.css).
--svg Integer This is the maximum length a SVG data URI may have. If only one icon exceeds this threshold, all data URIs of this icon set will be changed to external SVG sprite references. Defaults to 1048576 (1MB), minimum is 1024 (1kB).
--png Integer This is the maximum length a PNG data URI may have. If only one icon exceeds this threshold, all data URIs of this icon set will be changed to external PNG sprite references. Defaults to 32768 (32KB = Internet Explorer 8 limit), minimum is 1024 (1kB).
-d --dims If given, a second CSS rule for each icon will be created, setting the dimensions of the icon (via the width and height properties).
--width Integer Default width for icons (in pixels) in case the SVG file is missing a value. Must be between 1 and the maximum width (including).
--height Integer Default height for icons (in pixels) in case the SVG file is missing a value. Must be between 1 and the maximum height (including).
--maxwidth Integer Maximum width for icons (in pixels). Defaults to 1000.
--maxheight Integer Maximum height for icons (in pixels). Defaults to 1000.
--padding Integer Transparent padding to be added around each icon (in pixels). Defaults to 0.
--pseudo String You may bind an icon to a particular CSS pseudo class (like e.g. :hover, :active, :target). To do so, just append the desired pseudo class to the icon name, separated by a tilde ~. For instance, an icon named foo-bar~hover.svg will result in a CSS class icon-foo-bar:hover. If you need to use another delimiter than a tilde ~, just use this parameter to provide your custom string.
-k --keep During the compilation of the SVG and PNG sprites, iconizr also creates intermediate SVG and PNG versions of each single icon. Usually, these intermediate files are deleted at the end of the compilation process. If you want to keep these files for some reason, just add this argument.
In this case, also an additional set of stylesheets will be created (both CSS and/or Sass), which uses these single image icons (carrying the suffix -single.html). However, it is not recommended to use these stylesheets for production systems, and you should always prefer the CSS sprite or data URI variants for performance reasons. The single image icon stylesheets will also be ignored by the stylesheet loader JavaScript, but at least you will be able to select them explicitly using the icon kit preview documents.
-v --verbose Integer (optional) By default, iconizr operates quietly without any output. If you specify this argument (optionally using the value "1"), some simple status messages will be printed. Use "2" as value to even print the console output of the external tools being used (like e.g. pngcrush or pngquant).
--scour String iconizr can use either SVGO or Scour for cleaning the original SVG files. As far as I can tell, Scour yields slightly better results (i.e. smaller SVG files) than SVGO. As Scour is rather a Python script than an executable, you need to provide the full script path via this option if you want to use it (also, of course, Python has to be available on the system; see requirements).
--python String When using Scour for cleaning the original SVG files, you need to have Python 2 handy, as Scour is based on this version and hasn't been updated for quite a while. If your default Python binary is not version 2, you need to specify the absolute path to an alternative version 2 binary with this parameter.

CSS pseudo classes

As of Beta 5 iconizr supports CSS pseudo classes (like e.g. hover or active states) for individual icons. To bind an icon to a specific pseudo class, just append it as a suffix to the icon file name, separated by the string specified with the --pseudo parameter (defaults to a tilde ~). For example, two icon files named

	foo-bar.svg
	foo-bar~hover.svg

would result in the CSS rules

	icon-foo-bar { ... }
	icon-foo-bar:hover { ... }

This way you can easily achieve a normal and a hover state for an icon. In general, any conceivable pseudo class can be generated like this, as long as the involved characters are allowed in file names on your system. In fact, iconizr isn't aware of what is a real CSS pseudo class and what isn't, it's just dumb delimiter-to-colon substitution ... These could be some reasonable examples:

	hover
	active
	target
	first-child
	last-child
	nth-child()
	...

The storm icon included in this package is an example for an icon with hover state:

Normal storm icon Thunderstorm icon

In the HTML preview documents both icons will be shown, but also if you hover over the regular one, you will see it's hover state as well.

For every pseudo class iconizr also adds an additional CSS selector which you can use to explicitly apply the stateful icon styles to an element (independently from the element's real state). Starting with version v0.1.2 iconizr even adds such a selector for the regular icon state (which doesn't have a pseudo class by design), so you can also use this icon variant without letting the other pseudo classes become effective:

	icon-foo-bar, icon-foo-bar\:regular { ... }
	icon-foo-bar:hover, icon-foo-bar\:hover { ... }

To apply these icon styles to HTML elements just use them like this:

	<span class="icon-foo-bar:regular">Regular icon state</span>
	<span class="icon-foo-bar:hover">Hover icon state</span>

It may seem weird to use colons als parts of CSS class names, but in fact it's perfectly legal – you just have to escape the colons in your CSS files using a backslash \.

Comparison to grunticon

While doing pretty much the same as the Filament Group's / Scott Jehl's grunticon, iconizr especially focuses on reducing the size of files and number of HTTP requests, addressing mobile devices in particular:

  1. SVG files are cleaned and freed from a lot of cruft typically introduced by SVG editing application before they get converted to data URIs or embedded into the SVG sprite.
  2. PNG files are losslessly optimized (and optionally quantized to 8-bit files) before being used in data URIs or the PNG sprite.
  3. As soon as even one of the icons needs to be loaded externally (due to exceeding a potential data URI size limitation), all icons will get loaded via the corresponding sprite.

Evtl. kein Limit für data-URIs bei SVG? Welcher Browser mit SVG-Support hat das kleinste data-URI-Limit?

Rendering mode grunticon iconizr
PNG images / sprite Requests 11 2
Size (KB) 33.3 / 31.2 20.0 / 21.1
PNG data URI Requests 1 1
Size (KB) 30.1 / 41.1 20.3 / 29.7
SVG sprite Requests - 2
Size (KB) - 42.8 / 496.0
SVG data URI Requests 1 1
Size (KB) 126.0 / 1,913.0 49.4 / 720.0

Requirements

For iconizr to run, you will need some programs installed on your machine. These are:

  • PHP (kinda obvious)
  • PhantomJS (for rendering PNG images of your SVG drawings)

For SVG optimization you will need either of the following (or both):

For PNG optimization you should have as many of the following as possible:

Other versions

I'm currently working on a native Node.js / Grunt / Gulp.js implementation of iconizr. As a first step, I published svg-sprite (respectively grunt-svg-sprite) which will be the SVG sprite generator component. As opposed to the PHP based iconizr, svg-sprite comes with several improvements like Mustache template based output, so you can produce customized CSS output (formats). I plan to backport these improvements to the PHP based version as well.

Also, I'm very happy to announce that Haithem Bel Haj published an iconizr Grunt plugin that's based on the PHP based version of iconizr, so you can start using iconizr with Grunt right away! Cool, huh?

Resources

There are some useful resources on data URIs in general:

As soon as I'll find some time I will do some tests in our Open Device Lab to see if there are any device specific data URI limitations.

Resources on SVG support:

Legal

Copyright © 2014 Joschi Kuphal [email protected] / @jkphl

As of version 0.1.1, iconizr is licensed under the terms of the MIT license. Before that, a Creative Commons Attribution 3.0 Unported License applied.

The contained example SVG icons are part of the Tango Icon Library and belong to the Public Domain.

iconizr's People

Contributors

glensc avatar jkphl avatar pagelab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iconizr's Issues

Add support for Stylus output

Besides generating Sass output, iconizr should also support Stylus.
http://learnboost.github.io/stylus/

Preferable with the different omit settings i.e.:

CSS
a.button {
border-radius: 5px;
}

Omit braces
a.button
border-radius: 5px;

Omit semicolon
a.button
border-radius: 5px

Omit colons
a.button
border-radius 5px

Selector bug in SVG sprite Sass files

There's an error in Sass files created for SVG sprite icons. The suffix -dims (which is used for controlling the size of an icon) is also used for the rule identifying the icon image itself, which renders the whole file pretty useless.

Add a `common` option

As in svg-sprite, there should be a common option that allows for creating an additional, commonly used CSS class which declares the background-image and background-repeat properties for all single images. Depending on the number of images, this may save a lot of CSS code.

PNG sprite isn't being created

I want to output a single SVG sprite, PNG sprite and a CSS file with background positions for each of the 150-odd icons that I'm using.

I'm running the script in OSX and it's not creating a PNG sprite. It does make the CSS files with the PNGs as data URIs, but that's not what I'm after.

I tried replicating the weather example with the same command as in the readme, and the same thing happened: It doesn't create the PNG fallback.

Redundant data when using SVGs at multiple sizes

Perhaps I'm just not using iconizr right, but it seems that if you have a situation where the same icon is used at different sizes throughout a website that you have to create a unique SVG for every size so that you also have the appropriately sized PNG fallbacks. But since SVGs cleanly scale it seems redundant to have their data repeated for every size that the icon will be used at. Is there a way to avoid that redundancy?

Max. icon width and height

SVG icons with very large dimensions (e.g. 1000 x 1000 pixels) slow down the PNG optimization process dramatically. Iconizr should support settings for maximum width and height (also as a safety measure). Icons exceeding this maximum dimensions should get scaled down appropriately, thus speeding up the conversion process.

Support PNG fallbacks for SVG sprites

I would like to use this tool to generate SVG sprite with a PNG sprite fallback. I have a SASS mixin that does the job for single images:

@mixin svg-bg($filename, $extension: '.png') {
  background-image: image-url($filename + $extension);
  background-image: none, image-url($filename + '.svg');
}

It works very well an offers a very easy fallback method since ever browser that supports two backgrounds, also supports SVG.

Could this be integrated with iconizr? I would finally solve the messy SVG sprite stuff for me.

Support for generic image sprites and not just SVG

At this time, if you're using SASS, Compass is the de facto solution for generated sprite images. There's plenty of other solutions out there but none that are so easy to use or that actually simplifies your workflow.
Unfortunately, Compass is slow. I mean.... REALLY Slow. The solution for SASS is to use libsass which, obviously, doesn't support Compass.

Iconizr seems the perfect solution. It integrates nicely into a grunt workflow, it does the heavy lifting, creates the SASS classes automatically, and has a ton of nice features out of the box.
Unfortunately from what I've seen it's tailored to use SVG source "images", so if we wanted to use PNG source images instead, to generate a generic sprite image (as opposed to icons) we couldn't.

Do you think it will be possible for iconizr to support PNG icons as source images for the sprite?

Drop the `width` and `height` options

The width and height options, which are meant for SVG images that lack proper dimension settings, are somewhat useless. Applying fixed values for missing properties will always result in distorted images. Nobody wants that. Instead, the real image dimensions should be determined by test rendering the SVG via PhantomJS (like done in svg-sprite). The two options are therefore obsolete and should be removed.

Support for pseudo classes

It would be desirable to support CSS pseudo classes for icons as well, like e.g. a :hover state. This could be achieved by simply including the pseudo class in the icon filename. In theory, this does already work, but only as long as you upload your icons from a Linux platform (or any other platform that supports colons in file names, which isn't allowed under Windows and OS X). Therefore iconizr should support a substitution character to denote pseudo classes.

Default icon height don't work

I put 5 SVG icons with different dimensions (2 icons 19x19 and 3 icons 19x14) and set default icon width and height to 19px and padding to 2px.

In the end of process I got a sprite with original icons sizes (some of them are white):
icons

Maybe my original SVG files cause the problem - I don't know. I'll put several of them here:

19x19 icon:
<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 25 25"><svg id="loader" data-name="Layer 1" height="25" width="25" viewBox="0 0 25 25" y="0"><title>spinnerArtboard 1</title><path d="m11.62 21.46a9 9 0 0 1 -8.12 -9.22 9.1 9.1 0 0 1 8.75 -8.74 9 9 0 0 1 9.21 8.12 1 1 0 0 0 1 0.88h1.54a1 1 0 0 0 1 -1.11 12.5 12.5 0 1 0 -13.61 13.61 1 1 0 0 0 1.11 -1v-1.55a1 1 0 0 0 -0.88 -0.99z" fill="#999"/></svg></svg>

19x14 icon:

<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
	<!ENTITY ns_extend "http://ns.adobe.com/Extensibility/1.0/">
	<!ENTITY ns_ai "http://ns.adobe.com/AdobeIllustrator/10.0/">
	<!ENTITY ns_graphs "http://ns.adobe.com/Graphs/1.0/">
]>
<svg version="1.1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
	 x="0px" y="0px" width="18.839px" height="13.724px" viewBox="0 0 18.839 13.724" enable-background="new 0 0 18.839 13.724"
	 xml:space="preserve">
<g id="Layer_8">
	<g>
		<g>
			<path fill="#999999" d="M16.485,1.428c-0.181-0.166-0.474-0.165-0.654,0c-0.181,0.166-0.181,0.434,0,0.6
				c2.778,2.549,2.778,6.697,0,9.246c-0.181,0.166-0.181,0.435,0,0.6c0.181,0.166,0.473,0.166,0.654,0
				C19.624,8.994,19.624,4.308,16.485,1.428z M13.541,3.529c-0.181,0.166-0.181,0.435,0,0.6c1.515,1.39,1.515,3.653,0,5.043
				c-0.181,0.166-0.181,0.435,0,0.601c0.181,0.166,0.474,0.166,0.655,0c1.876-1.722,1.876-4.523,0-6.244
				C14.014,3.363,13.722,3.363,13.541,3.529z"/>
		</g>
		<path fill-rule="evenodd" clip-rule="evenodd" fill="#999999" d="M9.704,0.043c-0.129-0.066-0.284-0.055-0.402,0.03L3.454,4.272
			H0.387C0.173,4.272,0,4.446,0,4.66v4.405c0,0.214,0.173,0.388,0.387,0.388h3.067l5.847,4.199c0.067,0.048,0.146,0.073,0.226,0.073
			c0.06,0,0.121-0.014,0.177-0.043c0.129-0.066,0.21-0.2,0.21-0.345V0.388C9.914,0.242,9.833,0.109,9.704,0.043z"/>
	</g>
</g>
</svg>```

SVG2 (SVG 1.3) incompatible.

First i want to thank you, for all your efforts and all your time you have put into this project! :)

I have tried now several .svg, i had even problem with illustrator and wrote a issue there.
The version of my .svg is simply to new nothing seems to be compatible right now, only afinity desginer on ipad, a app for 20 bucks was able to.
So if Illustrator is to dump and a 20 bucks app is capable to keep the compatible formats uptodate, you should be even faster xD

Here a are the SVGs which i tried to use https://github.com/spothq/cryptocurrency-icons/tree/master/svg
I can find it anymore but i thing it is kinda svg version 1.3 even? at least 1.2.

Here if you want to waste your time that illustrator is simple not up to date, also also bugging arround with newest svg.
https://community.adobe.com/t5/illustrator/svg-files-doesn-t-open-correctly-illustrator/m-p/11392589?page=1#M190720

EDIT: I kinda found it now, they called it for sure 1.3 back, I am 100% sure at least at the svg img github repo i posted above.
But seems now it is now baptised to just SVG 2 instead of 1.3 just to make things clearly.
https://en.wikipedia.org/wiki/Scalable_Vector_Graphics
Under Development history, 1.2 was dorpped for SVG 2 (maybe internel at the beginning 1.3)
Latest Draft to SVG 2 from may 2020
https://www.w3.org/TR/SVG2/

Licensing issues with CC

Hi,

first, it's a great tool — thank you so much for doing this.
But then you applied a Creative Commons license for the code which is to say , honestly, not good at all. CC does not really work with code very well and therefore shouldn't be chosen as it causes many problems for users of the software. Read this pieces for more information please:

Please consider to change it to something like MIT (preferred by me) / GPL license if possible. Thank you :)

Animated pseudo effects?

Hi guys, I'm sure you've thought about how to achieve pseudo effects that could animate a property of the SVG - rather than a full replacement graphic.

This would require embedding the svg into the html, and some css declaration of said transition. So is probably out-of-scope for the project. But I'm still curious as to what type of thoughts/ideas you have for this?

Thx!

scour is Python 2 only

scour is a Python 2 programming and yields errors when run with Python 3. As iconizr currently just looks for the main Python version available (via which python), this might lead to problems. It should be verified that a Python 2 binary is used.

Publish latest release to npm

Latest release of module iconizr on npm is version v0.2.2 (last updated 3 months ago).
Could you publish the latest release to npm (v1.0.2)?.

Calling svgo

The documentation mentions compatibility with svgo. But iconizr --help just offers

--scour <string>           Absolute path to scour script for cleaning SVG files (see http://www.codedread.com/scour)

How do I use svgo?

SVGO / Scour are prone to errors

It turns out that Scour as well as SVGO are prone to errors when served with certain SVG files. At the moment, iconizr fails completely if even one SVG file fails optimizing. This has to be changed immediately.

While I found Scour to be prefered over SVGO (smaller resulting SVG files), it seems to be unmaintained since 2009, so it's unlikely that it's support for problematic SVG files will improve. SVGO could improve over time.

I think I'm going to implement multiple fallbacks: If Scour is available and requested, it will be used for SVG optimization. If it fails, iconizr will look for the presence of SVGO, and use it in case it is available. If even SVGO fails, the unoptimized SVG file will be used.

Flood of process

Hi!

For some time we started to use iconizr(grunt-iconizr) to create sprices of svg and a sprite fallback of pngs(thanks btw).

The problem is that now we have 182 svgs and all of them are launching independent process to convert them to png. This created a fooding of process.

Can this be done with a parallel limit approach? I'm thinking of NUMBER_OF_CPUS * 2.

Make »regular« icon state explicitly applicable

At the moment it is impossible to apply the regular state of an icon without implicitly applying it's hover state as well. The regular icon state should be available via a second, independent class name (which has no accompanying :hover pseudo class).

Hi there

I'd like to know when is the service comming back?

Web version fails when your SVG has a "fill"

I have been testing this tool out and it has worked fine until now; I had been using SVG's without a "fill"; but I wanted the icons to be blue. so I added a fill to my SVG icons I loaded in, such as:

<svg fill="##34495e" ...>

...but it seemed to choke on this; whilst it gave me all the folders, the only folder that had anything in it was the css/icons folder, which contained all the separate .svg icons. No .css files, no .scss files and no .png files which I requested.

Negative countdown

I set up everything for job. It said me to be patient since 2 jobs in queue.
After several sec the page was updated and it started to count negative seconds. It updated the page and counted negative seconds about 4 or 5 times before it returned me the result archive.

https://www.screencast.com/t/NbksjYDZxX

Rename dims class

Class for dimensions is long, but there is an easy way to fix it. I would suggest that instead of naming it .icon-name-dims, just name it .icon-name.dims. So output css file would look like:

.icon-arrow,.icon-arrow\:regular{background-image:url('../assets/svg/icons.svg');background-position:0 0;background-repeat:no-repeat}
.icon-arrow.dims{width:22px;height:15px}

and on HTML you could just write down

<div class="icon-arrow dims"></div>

Support for »Responsive Icons«

Similar to CSS pseudo classes, iconizr could natively support Responsive Icons, which means several versions of single icons that depend on screen / device / display metrics. This would require means of expressing the conditions under which a certain icon version should be shown. iconizr would simply have to generate the appropriate CSS media queries around the respective icon versions.

PNG

Hey,

I might be missing something, but i cannot seem to get this to produce an svg sprite and a png sprite. Its giving me svg only. My last attempt was this in terminal:

iconizr --png 32768 --out css/png img/svg

So im outputting into "css/png" all the svg's in "img/svg". But its placing an svg sprite, not a png.

From the docs, its seems like iconizr can do both at the same time...

(The svg sprite is great btw)

Confusing usage of SCSS version

Hello !
I must say I'm a bit confused about the usage of the iconizr's SCSS option outputs.

While you're providing some nice Sass / LESS example, some usage points remains obscure. Or maybe I'm just missing something..?

For exemple, since your exemple is exporting SCSS partials, I guess they're supposed to be included in the main stylesheet, like any partial. But which one to include ? If I want fallbacks, what can I do ? Am i just supposed to choose a stylesheet and include it and voila ? Or is there any way to have the same fallback as the CSS version ?

I guess the loader won't work, since it's designed to pick CSS files, and using partials they're aren't any.

Could anyone please enlighten me ? Is the SCSS outputs capable of providing fallbacks, and if so, how can I use them ? I'd love to be able to extend some icons classes, but without losing the great support iconizr provides !

Thanks a bunch !

SVGs rescaled to 300px wide if greater than 300px

Hi,

For some reason when I load a SVG (created in inkscape) to iconizr, then the resulting SVG has a maximum width of 300px. Even if the original width is greater than 300px. Although the vertical is scaled accordingly, this is not what I want.

Cheers,
Simon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.