Giter Club home page Giter Club logo

lit-fontawesome's Introduction

Lit-fontawesome

Icons of Fontawesome for Polymer 3 and LitElement

Installation

Use the package manager npm to install Lit-fontawesome.

npm install lit-fontawesome

In the HTML file, link css of Lit-fontawesome

<link rel="stylesheet" href="node_modules/lit-fontawesome/css/font.css">

Usage with LitElement

import { LitElement, html} from 'lit-element';
import Fontawesome from 'lit-fontawesome';

class SomeClass extends LitElement {
 static get styles() {
    return [ Fontawesome ];
 }
 render() {
    return html`
      <div>
         <i class="fas fa-address-card"></i>
      </div>
    `;
  }
}

customElements.define('custom-component', SomeClass );

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

lit-fontawesome's People

Contributors

quinszouls avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

lit-fontawesome's Issues

Importing CSS styles inside component and rendering is a must

The web components scheme is based on atomic design. This means that, in this case of atom, it should do its small job by itself.

What is missing here:

  • Import Font Awesome stylesheet directly into the element.
  • Remove import of stylesheet outside the component.
  • Render the icon inside the component.

add typescript support

I've been using Lit with typescript and found out the library wasn't working because missing types.
I actually added support for typescript and tried a pull request but I don't have the required rights to open a pull request.

In the meantime, to everyone who uses ts:

$ npm i -D typescript @types/node
$ tsc --init
$ mv fontawesome.js fontawesome.ts

just copy this into tsconfig.json

{
  "compilerOptions": {
    "module": "es2020",
    "target": "es2020",
    "sourceMap": true,
    "declaration": true,
    "outDir": "./dist",
    "moduleResolution": "Node"
  },
  "include": [
    "*"
  ],
  "exclude": [
    "dist"
  ]
}

then run

$ tsc

You can do this directly into nodes_modules/lit-fontawesome if you need it right now.

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.