mveytsman / heroicons_elixir

Phoenix components for Heroicons! 🛡️
MIT License
118 stars 28 forks source link

Generate module and optimize LiveView diffing #15

Closed chrismccord closed 2 years ago

chrismccord commented 2 years ago

This PR unifies the icon components into a single Heroicons module, and generates the module such that compile time is optimized when consumed as a dependency. On my laptop, build time is 1.1s.

This also optimizes the generated icon components so that their static svgs information is shared, which reduces the diff that LiveView calculates. A side effect of that changes also prunes the beamfile sizes down from 500kb to 250kb.

This PR comes at a cost of dropping backwards compatibility for non heex function component usage, as well as removes the ability for the components to be updated in user-land. the mix heroicons.update task is now private and used only to update the internal module when prepping for new heroicons.com releases.

greven commented 2 years ago

The idea to be able to update to the latest version in user-land came so users wouldn't be so dependent on updates to the library, even though @mveytsman has been doing a great job keeping up, but In the past I wanted to update to a minor version and had to wait so forked the library.

But as long as we keep up with the heroicons.com updates, since they are adding new icons constantly, I'm all up for this PR as it improves the library in several ways.

My biggest pain will be migrating all the icon calls to the new unified Module! 🙃

BTW, v.2.0.11 is already out with some new icons, might as well release the PR with that version? (https://github.com/tailwindlabs/heroicons/releases/tag/v2.0.11), I've taken the liberty of creating a PR against your commit with some typos fixes and the v2.0.11 version: https://github.com/chrismccord/heroicons_elixir/pull/1