Skip to content

Commit

Permalink
Refactor fontawesome (#1713)
Browse files Browse the repository at this point in the history
* feat: get fontawesome via npm

* chore: remove old way of using FA

* chore: remove manual FA includes

* style: regen resources

* chore: formatting

* chore: remove testing unused icons; fix file import

* chore: remove commented out line

* chore: re-gen js
  • Loading branch information
andrewleith authored Nov 8, 2023
1 parent 8e61b44 commit 1179ccf
Show file tree
Hide file tree
Showing 11 changed files with 886 additions and 1,619 deletions.
6 changes: 0 additions & 6 deletions app/assets/fontawesome/js/fontawesome.min.js

This file was deleted.

1,584 changes: 0 additions & 1,584 deletions app/assets/fontawesome/js/solid.js

This file was deleted.

33 changes: 33 additions & 0 deletions app/assets/javascripts/fontawesome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* This file loads in font awesome for use in Notify
* We only load the icons we use to keep the bundle size down. To add an icon:
* - import if from @fortawesome/free-solid-svg-icons
* - include it in the library.add call
*/
import { config } from "@fortawesome/fontawesome-svg-core";
import { library, dom } from "@fortawesome/fontawesome-svg-core";
import { faCheck } from "@fortawesome/free-solid-svg-icons/faCheck";
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons/faArrowUpRightFromSquare";
import { faPlus } from "@fortawesome/free-solid-svg-icons/faPlus";
import { faArrowRight } from "@fortawesome/free-solid-svg-icons/faArrowRight";
import { faAngleDown } from "@fortawesome/free-solid-svg-icons/faAngleDown";
import { faCircleQuestion } from "@fortawesome/free-solid-svg-icons/faCircleQuestion";
import { faTriangleExclamation } from "@fortawesome/free-solid-svg-icons/faTriangleExclamation";
import { faCircleExclamation } from "@fortawesome/free-solid-svg-icons/faCircleExclamation";

let FontAwesomeIconLoader = () => {
config.autoAddCss = false;
library.add([
faCheck,
faArrowUpRightFromSquare,
faPlus,
faArrowRight,
faAngleDown,
faCircleQuestion,
faTriangleExclamation,
faCircleExclamation,
]);
dom.watch();
};

export default FontAwesomeIconLoader;
3 changes: 3 additions & 0 deletions app/assets/javascripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import Polyglot from "node-polyglot";
//REVIEW: The app already has dayjs dep which is supposed to be a lightweight momentjs replacement. --jlr
import Moment from "moment";
import { DiffDOM } from "diff-dom";
import FontAwesomeIconLoader from "./fontawesome";

FontAwesomeIconLoader();

if (!window.APP_PHRASES || typeof APP_PHRASES === "undefined") {
window.APP_PHRASES = {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/main.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 1179ccf

Please sign in to comment.