Coder Social home page Coder Social logo

drygnet / stenciljs-icons-example Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 4.0 4.67 MB

Using FontAwesome, Office UI Fabric and Material -icons in stenciljs

License: MIT License

CSS 50.58% HTML 42.42% JavaScript 6.87% TypeScript 0.12% Shell 0.01%
stenciljs stencil-components font-awesome office-ui-fabric material-icons icons icon-font web-components

stenciljs-icons-example's Introduction

Built With Stencil

Use icons in stencil Generic badge

Demo of how to use icon libraries in stenciljs

Demo Image

Getting Started

To try this demo, clone this repo to a new directory:

git clone https://github.com/drygnet/stenciljs-icons-example.git 
cd stenciljs-icons-example
git remote rm origin

and run:

npm install
npm start

To build the component for production, run:

npm run build

Three approaches

FontAwesome

... uses the downloaded all.min.cssthat expects the font-files to be in the webfonts-directory on the server, look at the copy-block in stencil.config.js

Material Icons

... has all the CSS that is needed included in the component, the same webfonts-directory is used for simplicity

Office UI Fabric Icons

... uses the downloaded fabric-icons-inline.css that contains all the CSS and the actual font.

Extra files in assets-directory

Not all files in the assets directory are needed, just the ones referenced in the components and the font files that are copied via stencil.config.js I kept the files if you e.g. don't need the brand-icons in FontAwesome (replace all.min.css with the CSS you need in the component) or if you want to change the Material Icons implementation to use copied webfonts.

stenciljs-icons-example's People

Contributors

drygnet avatar johanblomgren-svs avatar

Stargazers

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

Watchers

 avatar  avatar

stenciljs-icons-example's Issues

Font-awesome and Office UI Fabric not working with stencil 1.13

It seems like stencil core version 1.13 shows blank images on Font-awesome and Office UI Fabric images.
image-blank

Repro steps:
Clone repo: git clone https://github.com/drygnet/stenciljs-icons-example.git
npm install && npm start
//This works, all images shows correctly.

//But if you remove package-lock.json and retry, it doesn't work:
rm -rf node_modules && rm package-lock.json
npm i && npm start
//package-lock.json now shows updated stencil-core version and images shows incorrectly.
image

It might just be a version issue, how can this be resolved?

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.