zksailor534 / react-adminlte-dash

This project is No Longer Maintained. React implementation of AdminLTE themed dashboard
http://zksailor534.github.io/react-adminlte-dash/
MIT License
167 stars 36 forks source link

how to include font-awesome in pages which are not using the adminlte #4

Closed mrharel closed 7 years ago

mrharel commented 7 years ago

I was thinking about it and wanted to know if you have some better way to do it. Lets say i have a login page which is not using the adminlte dashboard, and because of that the font-aweomse is not loaded (i think it is loaded in main.css), so the quesiton how to load font-awesome only in page which are not using the dashboard.

i don't want to load it anyway and might fave conflicts in the dashboard pages.

and good practice?

zksailor534 commented 7 years ago

First of all, I don't think loading font-awesome anywhere else in your application would conflict with the anything in the dashboard. It should be the same classes that are being referenced, regardless of where they are sourced. For example, if you sourced it in the main css file of your application, the class would just be sourced from the "closest" css file, the dashboard one in the dashboard, or yours in your login page.

I see 2 options: 1) load it in the main context, which will duplicate it but provide font-awesome too all your pages 2) load it locally, for each page that needs it, either from npm, bower, or cdn, which provides it only for the page you're on, but requires extra loading for that page

I'd probably go with choice 2, just to avoid doubling the loading for all the dashboard pages. I'm a bit unsure of best practice for this myself, but that's the path I'd go.