Skip to content

Commit

Permalink
feat: support custom icons exported through Font Awesome kits
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorik De Waen committed Oct 13, 2023
1 parent 757a607 commit 67b0510
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/codegen/IconsetEnumGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Vector;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -113,8 +114,11 @@ public class IconsetEnumGenerator {
put("fal", "light");
put("fad", "duotone");
put("thin", "thin");
put("fa-kit", "custom-icons");
}};

private static final Pattern kebabCasePattern = Pattern.compile("-([a-z])");

public static void main(String[] args) throws IOException {
fontAwesomeVersion = getRequiredProperty("codegen.tag"); //the version to be mentioned in the documentation
sprites = new File(getRequiredProperty("codegen.sprites")); //the location of the SVG sprites
Expand Down Expand Up @@ -187,7 +191,8 @@ private static void processAliases() throws IOException {

private static void process(CompilationUnit cu, String family, File sprites) throws IOException {
String familyName = FilenameUtils.getBaseName(sprites.getName());
String enumName = StringUtils.capitalize(familyName);
String camelCaseName = kebabCasePattern.matcher(familyName).replaceAll(m -> m.group(1).toUpperCase());
String enumName = StringUtils.capitalize(camelCaseName);
System.out.println(String.format("Generate %s icons (%s)", enumName, family));
File iconset = convertIconset(family, sprites);
List<String> icons = new ArrayList<>();
Expand Down

0 comments on commit 67b0510

Please sign in to comment.