Giter VIP home page Giter VIP logo

iconfont's Introduction

IconFont

CLI to convert CSS StyleSheets for Icon Fonts like FontAwesome to a CommonJS module that exports all unicodes by name. I use them in native iOS & Android apps build with Titanium.

Example

Install the CLI npm

Install the CLI via NPM like this:

$ [sudo] npm install -g iconfont

Generate a module

Just point the CLI to the CSS file:

$ iconfont font-awesome.css

This would create a file named font-awesome.js in the same directory as the CSS file. If you want to write to a different path, simply pass it as the second argument:

$ iconfont font-awesome.css ~/fa.js

Use the module

In Titanium, I'd use the module like this:

var icons = require('font-awesome');

var button = Ti.UI.createButton({
	font: {
		fontFamily: 'FontAwesome'
	},
	title: icons.flag
});

In Alloy you can do:

alloy.js

Alloy.Globals.icons = require('font-awesome');

index.tss

"Button": {
	title: Alloy.Globals.icons.flag
}

Notes

  • Icon names are camel-cased (arrow-up becomes arrowUp).
  • If all icon names share the same prefix this will be stripped out (icon-flag becomes flag).
  • The CLI expects selectors ending with :before.
  • The CLI expects declerations with a content property and a valid (unicode) string as value.

Changelog

  • 0.2.0:
    • Adds support for non-unicode content
    • Fixes camelCase for some-1 (#3)
  • 0.1.0: Initial release

Issues

Please report issues and features requests in the repo's issue tracker.

License

Distributed under MIT License.

iconfont's People

Contributors

fokkezb avatar

Watchers

Jong Eun Lee avatar James Cloos avatar

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.