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

Move fontawesome icons check at compile-time #2616

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

GuillaumeGomez
Copy link
Member

Now, we have the list of icons we use with their "variant(s)" (ie Brands, Regular or Solid) represented by a trait. To render as one of the variant, the corresponding method needs to be called.

@GuillaumeGomez GuillaumeGomez requested a review from a team as a code owner September 24, 2024 21:18
@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Sep 24, 2024
Copy link
Member

@syphar syphar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like what's possible with rinja & rust with a deeper integration between rust & the template.

Generally:

  • I think the compiled icon classes should be inside font-awesome-as-a-crate (perhaps behind a feature), and shouldn't have to be manually added. So all the icons can be added with the build script?
  • nit: I feel like accessing the icons in the templates shouldn't be via filters:: but something like icons::

@GuillaumeGomez
Copy link
Member Author

The icons structs are now generated in the sub-crate directly. Since there is no int into having the render_* method I originally added, I instead kept the filters and simply updated them. Code still got simplified and the checks are now at compile-time. :)

Copy link
Member

@syphar syphar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last question I think, thank you!

Generally I think before we create a release for the font-awesome crate we should add some documentation around the types (and for that matter, the old method to output the SVG). But we can do that separately.

src/web/page/mod.rs Show resolved Hide resolved
src/web/page/mod.rs Outdated Show resolved Hide resolved
@GuillaumeGomez
Copy link
Member Author

Updated!

@GuillaumeGomez
Copy link
Member Author

Removed serde impl on GlobalAlert and simplified the field to a specific icon.

@GuillaumeGomez GuillaumeGomez merged commit 1d5db8b into rust-lang:master Sep 27, 2024
11 checks passed
@GuillaumeGomez GuillaumeGomez deleted the f-a-check branch September 27, 2024 13:48
@github-actions github-actions bot added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 27, 2024
@GuillaumeGomez
Copy link
Member Author

Gonna send a follow-up for the doc for the fontawesome crate.

@syphar syphar removed the S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it label Oct 14, 2024
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.

2 participants