Skip to content

Commit 969de45

Browse files
authored
Reduce bundle size fortawesome (#1289)
1 parent 66e766c commit 969de45

34 files changed

+209
-38
lines changed

.eslintrc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,22 @@
173173
"ts": "never",
174174
"tsx": "never"
175175
}
176-
]
176+
],
177+
"no-restricted-imports": ["error", {
178+
"patterns": [
179+
{
180+
"group": ["@fortawesome/free-brands-svg-icons/*", "@fortawesome/free-brands-svg-icons"],
181+
"message": "Direct imports from @fortawesome/free-brands-svg-icons is not allowed. Import from src/ib/font_awesome/brands instead."
182+
},
183+
{
184+
"group": ["@fortawesome/pro-regular-svg-icons/*", "@fortawesome/pro-regular-svg-icons"],
185+
"message": "Direct imports from @fortawesome/pro-regular-svg-icons is not allowed. Import from src/lib/font_awesome/regular instead."
186+
},
187+
{
188+
"group": ["@fortawesome/pro-solid-svg-icons/*", "@fortawesome/pro-solid-svg-icons"],
189+
"message": "Direct imports from @fortawesome/pro-solid-svg-icons is not allowed. Import from src/lib/font_awesome/solid instead."
190+
}
191+
]
192+
}]
177193
}
178194
}

src/Accordion/Accordion.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { faCreditCard } from '@fortawesome/pro-regular-svg-icons';
3+
import { faCreditCard } from '../font_awesome/regular';
44
import Card from '../Card';
55

66
import {

src/Accordion/AccordionToggle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
77
import { useAccordionButton } from 'react-bootstrap/AccordionButton';
88
import AccordionContext from 'react-bootstrap/AccordionContext';
99

10+
import { faChevronUp } from '../font_awesome/solid';
11+
1012
import './AccordionToggle.scss';
11-
import { faChevronUp } from '@fortawesome/pro-solid-svg-icons';
1213

1314
import { isEventKeyActive } from './utils';
1415

src/Alert/Alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
faExclamationTriangle,
1111
faInfo,
1212
faTimes,
13-
} from '@fortawesome/pro-solid-svg-icons';
13+
} from '../font_awesome/solid';
1414

1515
import './Alert.scss';
1616

src/Button/Button.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import * as ComponentStories from './Button.stories';
3737
### Iconography
3838
- Font Awesome library
3939
- We utilize the Regular and Solid Font Awesome icons
40-
- Only use Solid icons on icon-only buttons. import `@fortawesome/pro-solid-svg-icons`
41-
- Use Regular icons for all other buttons. import `@fortawesome/pro-regular-svg-icons`
40+
- Only use Solid icons on icon-only buttons. import relatively from `src/font_awesome/solid`
41+
- Use Regular icons for all other buttons. import relatively from `src/font_awesome/regular`
4242
- Use a leading icon alongside a label if there is a primary action verb (e.g. Edit, Share, Copy)
4343
- Icon-only buttons should only be permitted if
4444
- Space is limited (e.g. too small for text alone)

src/Button/Button.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from 'react';
22

33
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
4-
import { faFileAlt, faCaretDown, faPaperPlane } from '@fortawesome/pro-regular-svg-icons';
4+
import { faFileAlt, faCaretDown, faPaperPlane } from '../font_awesome/regular';
55
import {
66
faGoogle, faFacebook, faLinkedin, faTwitter,
7-
} from '@fortawesome/free-brands-svg-icons';
7+
} from '../font_awesome/brands';
88
import Button from '.';
99
import mdx from './Button.mdx';
1010

src/Button/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import React, { forwardRef } from 'react';
22
import classNames from 'classnames';
33
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
44
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5-
import { faSpinnerThird } from '@fortawesome/pro-regular-svg-icons';
6-
75
import {
86
Button as RBButton,
97
type ButtonProps as RBButtonProps,
108
} from 'react-bootstrap';
119

10+
import { faSpinnerThird } from '../font_awesome/regular';
11+
1212
import './Button.scss';
1313

1414
export enum ButtonSizes {

src/Container/Col.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type ColProps as ReactBootstrapColProps,
55
} from 'react-bootstrap';
66

7-
import { useDeprecationWarning } from 'src/utils';
7+
import { useDeprecationWarning } from '../utils';
88

99
export type ColProps = {
1010
/**

src/Container/Container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type ContainerProps as ReactBootstrapContainerProps,
55
} from 'react-bootstrap';
66

7-
import { useDeprecationWarning } from 'src/utils';
7+
import { useDeprecationWarning } from '../utils';
88

99
export type ContainerProps = {
1010
/**

src/Container/Row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type RowProps as ReactBootstrapRowProps,
55
} from 'react-bootstrap';
66

7-
import { useDeprecationWarning } from 'src/utils';
7+
import { useDeprecationWarning } from '../utils';
88

99
export type RowProps = {
1010
/**

0 commit comments

Comments
 (0)