Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change icons to vector #1013

Merged
merged 1 commit into from
Oct 11, 2019
Merged

Change icons to vector #1013

merged 1 commit into from
Oct 11, 2019

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Jan 9, 2018

This will make selfoss look crisper on hi-res displays and also allow better user.css theming.

@jtojnar jtojnar added this to the 2.18 milestone Jan 9, 2018
@jtojnar jtojnar modified the milestones: 2.18, 3.0 Feb 24, 2018
@jtojnar jtojnar modified the milestones: 3.0, 2.19 Mar 9, 2018
@jtojnar jtojnar force-pushed the svg-icons branch 2 times, most recently from 67477c3 to 90c34c7 Compare July 9, 2018 13:40
@jtojnar jtojnar mentioned this pull request Feb 21, 2019
@jtojnar jtojnar mentioned this pull request Sep 27, 2019
3 tasks
@jtojnar jtojnar force-pushed the svg-icons branch 2 times, most recently from e13e6ad to 2053725 Compare October 5, 2019 10:18
@jtojnar
Copy link
Member Author

jtojnar commented Oct 5, 2019

Aargh! With the icons, the generated bundle is huge (2 MB).

I tried subsetting the icons like

import { fas } from '@fortawesome/free-solid-svg-icons';
library.add(fas.faCog);

and then

import { faCog } from '@fortawesome/free-solid-svg-icons';
library.add(faCog);

but neither of these really made the bundle smaller.

Finally I switched to deep imports

import { faCog } from '@fortawesome/free-solid-svg-icons/faCog';
library.add(faCog);

getting the size back down to 0.4 MB.

It turns out Parcel still does not use tree shaking by default, you have to enable it with --experimental-scope-hoisting flag. And enabling it breaks jQuery mousewheel since it is a bowl of spaghetti like all jQuery-related things.

Well never mind, I have been meaning to get rid of the custom scrollbar for a long time. But, apparently, it also does not support source maps. Welp.

jtojnar added a commit that referenced this pull request Oct 5, 2019
Parcel’s tree shaking is shaky:

#1013 (comment)
@jtojnar jtojnar requested a review from niol October 5, 2019 14:10
jtojnar added a commit that referenced this pull request Oct 5, 2019
Parcel’s tree shaking is shaky:

#1013 (comment)
jtojnar added a commit that referenced this pull request Oct 9, 2019
Parcel’s tree shaking is shaky:

#1013 (comment)
jtojnar added a commit that referenced this pull request Oct 11, 2019
Vector icons will look much crisper on HiDPI devices. Using them will also allow us to colour them in a dark theme.

We use FontAwesome DOM loading script for now. We will be able to use the `icon` helper directly in JSX when we complete the switch to client side rendering.

For size reasons, we are subsetting the icons, so when we want to use an icon not already used, we will need to add it here. But this was true for image files as well.

We need to use deep imports for plug-ins, though, since Parcel’s tree shaking is shaky: #1013 (comment)

We also no longer depend on parcel-plugin-static-files-copy, since we only used it for icons referrence by <img> tag from PHP templates (not picked up by Parcel).
Vector icons will look much crisper on HiDPI devices. Using them will also allow us to colour them in a dark theme.

We use FontAwesome DOM loading script for now. We will be able to use the `icon` helper directly in JSX when we complete the switch to client side rendering.

For size reasons, we are subsetting the icons, so when we want to use an icon not already used, we will need to add it here. But this was true for image files as well.

We need to use deep imports for plug-ins, though, since Parcel’s tree shaking is shaky: #1013 (comment)

We also no longer depend on parcel-plugin-static-files-copy, since we only used it for icons referrence by <img> tag from PHP templates (not picked up by Parcel).
@jtojnar jtojnar merged commit 1ea3dd2 into master Oct 11, 2019
@jtojnar jtojnar mentioned this pull request Oct 12, 2019
@jtojnar jtojnar deleted the svg-icons branch February 19, 2020 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant