wintercms / winter

Free, open-source, self-hosted CMS platform based on the Laravel PHP Framework.
https://wintercms.com
MIT License
1.31k stars 188 forks source link

Improve Font Awesome building and handling (update to 6.5.2) #1096

Closed bennothommo closed 3 months ago

bennothommo commented 3 months ago

Fixes https://github.com/wintercms/winter/issues/1090

bennothommo commented 3 months ago

The Workshop theme now has a page that allows you to review the available Font Awesome icons. You can install it then navigate to CMS -> Font Awesome Icons.

LukeTowers commented 3 months ago

@bennothommo this might cause problems with how I load in the fonts on the frontend for use in my EasyForms plugin (as well as a simplified version for just icons):

plugins/cadets/core/assets/less/select.less: (used on https://cadets.site/)

@base_path: "../../../../..";
// @base_path: "../../../../../Core/winter";

@winterAssets: "@{base_path}/modules/backend/assets/less";
@stormAssets: "@{base_path}/modules/system/assets/ui/less";

@import "@{winterAssets}/core/boot.less";
@font-path: "/modules/system/assets/ui/font";
@image-path: "/modules/system/assets/ui/images";
@icon-font-path: @font-path;

.unit-selector {
    @import "@{stormAssets}/../icons.less";
}

@import "@{stormAssets}/select.less";
LukeTowers commented 3 months ago

Could we come up with a simplified way to include the icon assets in the frontend (and while we're at it maybe the select2 assets as well)?

bennothommo commented 3 months ago

@LukeTowers why are you including the entire icon LESS file inside the .unit-selector class selector? Are you intending for icons to only show within that class?

As to how to include the icon assets easily in the frontend - the icons CSS file is already split off from the rest of Storm, and is accessible at modules/system/assets/ui/icons.css. It would be trivial to just include that in any theme. The Select2 CSS is currently merged in with the rest of the Storm UI, but I suppose you could split off its CSS as well.

LukeTowers commented 3 months ago

After looking at it again, it's fine for https://cadets.site to just include the icons.css directly, but the reason I took that approach with the EasyForms plugin is because I didn't want to cause any conflicts with existing icon systems in themes. It's not the end of the world though, if it causes a problem for someone then I can always just make it optionally include that CSS and they can figure out how they want icons to work in their theme themselves.