All Projects → ivanvotti → Ember Svg Jar

ivanvotti / Ember Svg Jar

Licence: mit
🍯 Best way to use SVG images in Ember apps

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ember Svg Jar

Ember Models Table
Table with pagination, sorting, filtering and much more
Stars: ✭ 212 (-8.62%)
Mutual labels:  ember-addon
React Trend
📈 Simple, elegant spark lines
Stars: ✭ 2,453 (+957.33%)
Mutual labels:  svg
Ember Service Worker
A pluggable approach to Service Workers for Ember.js
Stars: ✭ 227 (-2.16%)
Mutual labels:  ember-addon
React Sigma
Lightweight React library for drawing network graphs built on top of SigmaJS
Stars: ✭ 217 (-6.47%)
Mutual labels:  svg
Svg Path Visualizer
Enter a SVG path data to visualize it and discover all its different commands
Stars: ✭ 218 (-6.03%)
Mutual labels:  svg
Density Converter
A multi platform image density converting tool converting single or batches of images to Android, iOS, Windows or CSS specific formats and density versions given the source scale factor or width/height in dp. It has a graphical and command line interface and supports many image types (svg, psd, 9-patch, etc.) aswell as some lossless compressors like pngcrush.
Stars: ✭ 222 (-4.31%)
Mutual labels:  svg
Contrast Swatch
🅰️ Image microservice for color contrast information
Stars: ✭ 210 (-9.48%)
Mutual labels:  svg
Svg Credit Card Payment Icons
SVG Credit Card & Payment Icons: 6 Styles, 80 Icons
Stars: ✭ 227 (-2.16%)
Mutual labels:  svg
Gooey React
The gooey effect for React, used for shape blobbing / metaballs (0.5 KB) 🧽
Stars: ✭ 219 (-5.6%)
Mutual labels:  svg
Ember Font Awesome
ember-cli addon for using Font Awesome icons in Ember apps
Stars: ✭ 225 (-3.02%)
Mutual labels:  ember-addon
Svg
SVG奇思妙想
Stars: ✭ 217 (-6.47%)
Mutual labels:  svg
Ember Ajax
Service for making AJAX requests in Ember applications
Stars: ✭ 218 (-6.03%)
Mutual labels:  ember-addon
Perfcascade
Responsive, SVG based HAR waterfall viewer
Stars: ✭ 225 (-3.02%)
Mutual labels:  svg
Kld Intersections
A library of intersection algorithms covering all SVG shape types
Stars: ✭ 214 (-7.76%)
Mutual labels:  svg
React Kawaii
Cute SVG React Components
Stars: ✭ 2,709 (+1067.67%)
Mutual labels:  svg
Ng Inline Svg
[Inactive] Angular directive for inserting an SVG file inline within an element.
Stars: ✭ 211 (-9.05%)
Mutual labels:  svg
Ember Cli Document Title
Adding document title behaviour to your ember app
Stars: ✭ 220 (-5.17%)
Mutual labels:  ember-addon
React Svg Inline
DEPRECATED, I recommend you the tool SVGR
Stars: ✭ 230 (-0.86%)
Mutual labels:  svg
Charts
Simple, responsive, modern SVG Charts with zero dependencies
Stars: ✭ 14,112 (+5982.76%)
Mutual labels:  svg
Parse
Go parsers for web formats
Stars: ✭ 224 (-3.45%)
Mutual labels:  svg

Logo

Best way to use SVG images in Ember apps.

🎮 View Live Demo · 🐞 Report Bug · 🍩 Request Feature · 🤔 Ask Question

Build Status Ember Observer Score

Table of Contents

🍩 Features

Here's some of useful features:

  • Visual workflow to find and use SVGs the fastest way possible
  • Automatic SVG optimization (it can cut file size by half or more)
  • Easy to use helper {{svg-jar "asset-name"}}
  • Support for both inline and symbol embedding methods
  • Copy SVG as CSS background
  • Zero configuration

👋 Getting started

Installation

$ ember install ember-svg-jar

Start in 3 easy steps

  • 1️⃣ Drop some SVG images to the public directory (e.g. material-design-icons)

  • 2️⃣ Open the asset viewer and select any icon you like

  • 3️⃣ Copy the helper code from the viewer and paste it to your template

🎮 Usage

Place your SVG images to the public directory (e.g. ./public/images/my-icon.svg). Then copy the helper code for your image from the asset viewer or just write it by hand like this: {{svg-jar "my-icon"}}.

The viewer is available at: http://localhost:4200/ember-svg-jar/index.html

If your rootURL is not /, then to use the asset viewer you will need to add rootURL to the addon config.

Helper

Use the svg-jar helper to embed SVG images to your application's templates.

For the default inline embedding strategy you can write:

{{svg-jar "my-cool-icon" class="icon" width="24px"}}

The helper takes an asset ID and optional attributes that will be added to the created SVG element. The example above will create an SVG like this:

<svg class="icon" width="24px">...</svg>

For the symbol strategy you will need to add # to the asset ID like this:

{{svg-jar "#my-cool-icon"}}

In this case the result can look like this:

<svg><use xlink:href="#my-cool-icon"></use></svg>

Accessibility

Pass title, desc, and role as properties to the helper in order to include accessible elements or attributes. aria-labelledby will be automatically added and point to title and/or desc if they are included.

Writing this:

{{svg-jar "my-cool-icon" role="img" title="Icon" desc="A very cool icon"}}

Will create an SVG that looks like this:

<svg role="img" aria-labelledby="title desc">
  <title id="title">Icon</title>
  <desc id="desc">A very cool icon<desc>
</svg>

Assets from Node modules

By default ember-svg-jar looks for SVGs in the public directory. To get SVGs from node_modules packages or any other directory you will need to add them to ember-cli-build.js like this:

var app = new EmberApp(defaults, {
  svgJar: {
    sourceDirs: [
      'node_modules/material-design-icons/file/svg/design',
      'node_modules/material-design-icons/action/svg/design',
      'public/images/icons',
    ],
  },
});

Click here for more configuration options

Usage in an addon

Using ember-svg-jar in an addon is the same as in an app, except that in the package.json of the addon, it should be listed as one of the dependencies and not devDependencies.

🔧 Configuration

The addon should be useful without any configuration. But it wants to be very configurable when it's time to adjust it for your needs.

❓ FAQ

Q: Will the asset viewer affect my production build size?
A: No, it won't at all. The asset viewer is included in development mode only.

Q: Can it find SVG icons outside of the public directory, e.g. from node_modules?
A: Yes, it can import SVGs from any directory defined in the sourceDirs array.

Q: Why the SVG files deployed into the dist/assets folder without being fingerprinted?
A: This is done with the default ember cli behaviour. For more information see SVG Fingerprinting.

Q: Why does this matter?

Q: Why would you switch from Font Awesome to SVG?

  • original Font Awesome is about 149 KB as TTF and 88.3 KB as WOFF
  • it includes 634 icons and you need just some of them usually
  • 20 Font Awesome icons in SVGJar will be about 4.3 KB (you save 84 KB or 145 KB as TTF)
  • 50 Font Awesome icons in SVGJar will be about 9 KB

You can get Font Awesome icons as individual SVG files from font-awesome-svg.

👓 Compatibility

Latest ember-svg-jar 2.X.X currently supports:

  • Node 8.* || >= 10.*
  • Ember >= 2.X.X

💟 Contributors

Contributions of any kind welcome! See the Contributing guide for details.

Thanks goes to these wonderful people:


Ivan Votti

James Herdman

Edward Faulkner

Tobias Bieniek

Robert Wagner

Peter Wagenet

Ryan Cook

Mirko Akov

Ewan McDougall

Mark Catley

John Griffin

Ivan Lučin

James Shih

djsegal

Jan Buschtöns

Sivasubramanyam A

Alex DiLiberto

Brian Runnells

Jen Weber

Frédéric Soumaré

David Laird

Daan van Etten

Tom Carter

Ivan Gromov

Ruslan Hrabovyi

Alex LaFroscia

Laura Knight

Alberto Cantú Gómez

Sergey Astapov

🆓 License

This project is distributed under the MIT license.


GitHub @ivanvotti  ·  Twitter @ivanvotti

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].