Skip to content

Commit

Permalink
feat(chore): LESS maps instead of css overrides
Browse files Browse the repository at this point in the history
This change switches from hardcoded icon selectors in icon.overrides to LESS maps in icon.variables so they are easily changeable in a different theme

The previously extra handling of the "500px" class is not needed (in this script) anymore as it would break the LESS map generation and the conversion to "\35 00px" is now done in FUIs 2.9.0 icon.less file itself.
  • Loading branch information
lubber-de committed Oct 9, 2022
1 parent dc714b6 commit 85fc434
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 234 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] 2022-09-29

Fomantic-UI 2.9.0+ support only. If you need this script for FUI <= 2.8.8 or SUI, use 1.1.0 instead

### Changed
- Adjusted templates to generate icon.variables for new LESS mapping as of FUI 2.9.0

## [1.1.0] 2022-09-28

This is the last minor version working with FUI < 2.9.0 and SUI 2.4.x
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# [Fomantic-UI](https://github.com/fomantic/Fomantic-UI) Icon CLI Tool

Generate the `icon.overrides` and `icon.html.eco` files for Fomantic-UI up to 2.8.x (or Semantic-UI).
Generate the `icon.variables` and `icon.html.eco` files for Fomantic-UI 2.9.0+

> If you need this tool for FUI <= 2.8.8 or SUI, use version 1.1.0
You can use this script to generate the icons for free and pro versions of [FontAwesome](https://fontawesome.com).

Expand Down
3 changes: 0 additions & 3 deletions lib/static/corrections.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"name": "accessible",
"className": "accessible"
},
"500px": {
"className": "\\35 00px"
},
"vimeo-v": {
"name": "vimeo v",
"className": "vimeo.v"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-fomantic-icons",
"version": "1.1.0",
"description": "A simple CLI to generate the icon.overrides and icon.html.eco files for FUI",
"version": "1.2.0",
"description": "A simple CLI to generate the icon.variables and icon.html.eco files for FUI",
"author": "Sean Hamilton <sean@hamistudios.com>",
"license": "MIT",
"homepage": "https://github.com/fomantic/create-fomantic-icons#readme",
Expand Down
3 changes: 0 additions & 3 deletions src/static/corrections.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"name": "accessible",
"className": "accessible"
},
"500px": {
"className": "\\35 00px"
},
"vimeo-v": {
"name": "vimeo v",
"className": "vimeo.v"
Expand Down
3 changes: 3 additions & 0 deletions src/templates/icon.html.eco.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ themes : ['Default']
</div>

<div class="ui ignored message">Fomantic includes a complete port of <a href="https://fontawesome.com/" target="_blank">Font Awesome {{ version }}</a> designed by the <a href="https://twitter.com/fontawesome">FontAwesome</a> team for its standard icon set.</div>
<div class="ui ignored info message">
You can reduce your custom generated CSS by adjusting the <code>@icons-map</code>,<code>@icons-outline-map</code>, <code>@icons-brand-map</code>, ... variables in your themes <code>icon.variables</code> file to only the icons you need.
</div>

{% for category in categories -%}
<div class="icon example">
Expand Down
181 changes: 1 addition & 180 deletions src/templates/icon.overrides.liquid
Original file line number Diff line number Diff line change
@@ -1,182 +1,3 @@
/*
* Font Awesome {{ version }} by @fontawesome [https://fontawesome.com]
* License - https://fontawesome.com/license (Icons: CC BY 4.0 License, Fonts: SIL OFL 1.1 License, CSS: MIT License)
*/

/*******************************

Fomantic-UI integration of FontAwesome :

// class names are separated
i.icon.angle-left => i.icon.angle.left

// variations are extracted
i.icon.circle => i.icon.circle
i.icon.circle-o => i.icon.circle.outline

// abbreviation are replaced by full words
i.icon.*-h => i.icon.*.horizontal
i.icon.*-v => i.icon.*.vertical
i.icon.alpha => i.icon.alphabet
i.icon.asc => i.icon.ascending
i.icon.desc => i.icon.descending
i.icon.alt => i.icon.alternate


Icons are order A-Z in their group, Solid, Outline, Thin (Pro only) and Brand

Theme Overrides
*******************************/


/*******************************
Icons
*******************************/
& when(@variationIconDeprecated) {
/* Deprecated *In/Out Naming Conflict) */
i.icon.linkedin.in::before { content: "\f0e1"; }
i.icon.zoom.in::before { content: "\f00e"; }
i.icon.zoom.out::before { content: "\f010"; }
i.icon.sign.in::before { content: "\f2f6"; }
i.icon.in.cart::before { content: "\f218"; }
i.icon.log.out::before { content: "\f2f5"; }
i.icon.sign.out::before { content: "\f2f5"; }
}

{% if icons.solid.icons.length > 0 -%}
& when(@variationIconSolid) {
/*******************************
Solid Icons
*******************************/

/* Icons */
{% for icon in icons.solid.icons -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; }
{% endfor %}
}
{% if icons.solid.aliases.length > 0 -%}
& when(@variationIconAliases) {
/* Aliases */
{% for icon in icons.solid.aliases -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; }
{% endfor %}
}
{%- endif %}{%- endif %}

{%- if icons.outline.icons.length > 0 %}
& when (@variationIconOutline) {
/*******************************
Outline Icons
*******************************/

/* Outline Icon */
& when (@importOutlineIcons) {
/* Load & Define Icon Font */
@font-face {
font-family: @outlineFontName;
src: @outlineFallbackSRC;
src: @outlineSrc;
font-style: normal;
font-weight: @normal;
font-variant: normal;
text-decoration: inherit;
text-transform: none;
}
}

i.icon.outline {
font-family: @outlineFontName;
}

/* Icons */
{% for icon in icons.outline.icons -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; }
{% endfor %}

{% if icons.outline.aliases.length > 0 -%}
& when(@variationIconAliases) {
/* Aliases */
{% for icon in icons.outline.aliases -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; }
{% endfor %}
}
{%- endif %}
}
{%- endif %}

{% if icons.thin.icons.length > 0 -%}
& when (@variationIconThin) {
/*******************************
Thin Icons
*******************************/

/* Thin Icon */
& when (@importThinIcons) {
/* Load & Define Icon Font */
@font-face {
font-family: @thinFontName;
src: @thinFallbackSRC;
src: @thinSrc;
font-style: normal;
font-weight: @normal;
font-variant: normal;
text-decoration: inherit;
text-transform: none;
}
}

i.icon.thin {
font-family: @thinFontName;
}

/* Icons */
{% for icon in icons.thin.icons -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; }
{% endfor %}

{% if icons.thin.aliases.length > 0 -%}
& when(@variationIconAliases) {
/* Aliases */
{% for icon in icons.thin.aliases -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; }
{% endfor %}
}
{%- endif %}
}

{%- endif %}

{% if icons.brand.icons.length > 0 -%}
& when(@variationIconBrand) {
/*******************************
Brand Icons
*******************************/

& when (@importBrandIcons) {
/* Load & Define Brand Font */
@font-face {
font-family: @brandFontName;
src: @brandFallbackSRC;
src: @brandSrc;
font-style: normal;
font-weight: @normal;
font-variant: normal;
text-decoration: inherit;
text-transform: none;
}
}

/* Icons */
{% for icon in icons.brand.icons -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; font-family: @brandFontName; }
{% endfor %}

{% if icons.brand.aliases.length > 0 -%}
& when(@variationIconAliases) {
/* Aliases */
{% for icon in icons.brand.aliases -%}
i.icon.{{ icon.className }}::before { content: "{{ icon.unicode }}"; font-family: @brandFontName; }
{% endfor %}
}
{%- endif %}
}
{%- endif %}
Loading

0 comments on commit 85fc434

Please sign in to comment.