Skip to content

Commit

Permalink
Upgrades Heroicons to v2.1.1, and adds support for the new -micro v…
Browse files Browse the repository at this point in the history
…ariant (#5669)

The `-micro` variant is a new set of 16x16px icons.
To support the smaller size correctly, changes are
made in `tailwind.config.js`.
  • Loading branch information
arjunbajaj authored Dec 19, 2023
1 parent 2840697 commit 8953b6f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions installer/templates/phx_assets/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ module.exports = {
let icons = [
["", "/24/outline"],
["-solid", "/24/solid"],
["-mini", "/20/solid"]
["-mini", "/20/solid"],
["-micro", "/16/solid"]
]
icons.forEach(([suffix, dir]) => {
fs.readdirSync(path.join(iconsDir, dir)).forEach(file => {
Expand All @@ -50,6 +51,7 @@ module.exports = {
matchComponents({
"hero": ({name, fullPath}) => {
let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, "")
let spacing = name.endsWith("-micro") ? theme("spacing.4") : theme("spacing.5")
return {
[`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`,
"-webkit-mask": `var(--hero-${name})`,
Expand All @@ -58,8 +60,8 @@ module.exports = {
"background-color": "currentColor",
"vertical-align": "middle",
"display": "inline-block",
"width": theme("spacing.5"),
"height": theme("spacing.5")
"width": spacing,
"height": spacing
}
}
}, {values})
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_single/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ defmodule <%= @app_module %>.MixProject do
{:tailwind, "~> 0.2", runtime: Mix.env() == :dev},
{:heroicons,
github: "tailwindlabs/heroicons",
tag: "v2.0.18",
tag: "v2.1.1",
app: false,
compile: false,
sparse: "optimized"},<% end %><%= if @mailer do %>
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_umbrella/apps/app_name_web/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule <%= @web_namespace %>.MixProject do
{:tailwind, "~> 0.2", runtime: Mix.env() == :dev},
{:heroicons,
github: "tailwindlabs/heroicons",
tag: "v2.0.18",
tag: "v2.1.1",
app: false,
compile: false,
sparse: "optimized"},<% end %>
Expand Down
2 changes: 1 addition & 1 deletion integration_test/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ defmodule Phoenix.Integration.MixProject do
{:tailwind, "~> 0.2"},
{:heroicons,
github: "tailwindlabs/heroicons",
tag: "v2.0.18",
tag: "v2.1.1",
app: false,
compile: false,
sparse: "optimized"},
Expand Down

0 comments on commit 8953b6f

Please sign in to comment.