Class SymbolCraftExtension

    • Constructor Detail

      • SymbolCraftExtension

        SymbolCraftExtension()
    • Method Detail

      • getCacheEnabled

         abstract Property<Boolean> getCacheEnabled()

        enables reuse of downloaded SVG assets between builds.

      • getCacheDirectory

         abstract Property<String> getCacheDirectory()

        directory that hosts cached SVG payloads (relative to build/ by default).

      • getOutputDirectory

         abstract Property<String> getOutputDirectory()

        Kotlin source folder where generated code will be written.

      • getPackageName

         abstract Property<String> getPackageName()

        root package used for generated Kotlin types.

      • getGeneratePreview

         abstract Property<Boolean> getGeneratePreview()

        toggles Compose preview function generation for each icon.

      • getMaxRetries

         abstract Property<Integer> getMaxRetries()

        maximum number of retry attempts for failed downloads (default: 3).

      • getRetryDelayMs

         abstract Property<Long> getRetryDelayMs()

        initial delay between retries in milliseconds (default: 1000ms).

      • naming

         final Unit naming(Action<NamingConfig> action)

        Configure icon naming transformation.

        Example:

        naming {
            pascalCase(suffix = "Icon")  // Preset
            // Or customize:
            namingConvention.set(NamingConvention.PASCAL_CASE)
            suffix.set("Icon")
            removePrefix.set("ic_")
        }
        Parameters:
        action - Configuration action for NamingConfig
      • iconConfig

         final Unit iconConfig(String name, IconConfig config)

        Generic method to add an icon with any IconConfig implementation.

        This method supports both built-in and user-defined icon libraries.

        Example:

        iconConfig("home", MaterialSymbolsConfig(weight = SymbolWeight.W400))
        iconConfig("custom", MyCustomIconConfig(style = "filled"))
        Parameters:
        name - Icon name
        config - IconConfig implementation
      • iconConfigs

         final Unit iconConfigs(String names, Function1<String, IconConfig> configFactory)

        Batch configure multiple icons with the same configuration.

        Parameters:
        names - Icon names
        configFactory - Factory function that creates IconConfig for each icon name
      • materialSymbol

         final Unit materialSymbol(String name, Function1<MaterialSymbolsBuilder, Unit> configure)

        Configure Material Symbols icons with DSL builder.

        Example:

        materialSymbol("home") {
            weights(400, 500, 700)
            variant = SymbolVariant.OUTLINED
        }
        Parameters:
        name - Material Symbol icon name
        configure - Configuration block
      • materialSymbols

         final Unit materialSymbols(String names, Function1<MaterialSymbolsBuilder, Unit> configure)

        Convenience overload for configuring multiple Material Symbols with the same style block.

        Parameters:
        names - Material Symbol icon names
        configure - Configuration block applied to each icon
      • externalIcon

         final Unit externalIcon(String name, String libraryName, Function1<ExternalIconBuilder, Unit> configure)

        Configure external icon from other icon libraries with URL template.

        The URL template supports the following placeholders:

        • {name}: Replaced with the icon name

        • {key}: Replaced with custom style parameter values

        Examples:

        // Simple icon URL
        externalIcon("bell", libraryName = "bootstrap-icons") {
            urlTemplate = "https://esm.sh/bootstrap-icons/fill/{name}.svg"
        }
        
        // With custom style parameters
        externalIcon("home", libraryName = "heroicons") {
            urlTemplate = "https://cdn.jsdelivr.net/npm/heroicons/{size}/{name}.svg"
            styleParam("size", "24")
        }
        
        // Multi-value style parameters for variants
        externalIcon("home", libraryName = "official") {
            urlTemplate = "https://example.com/{name}_{fill}_24px.svg"
            styleParam("fill") {
                values("", "fill1")  // unfilled, filled variants
            }
        }
        
        // Custom CDN
        externalIcon("my-icon", libraryName = "mylib") {
            urlTemplate = "https://my-cdn.com/icons/{name}.svg"
        }
        Parameters:
        name - Icon name (replaces {name} in URL template)
        libraryName - Library identifier (used for cache isolation)
        configure - Configuration block
      • externalIcons

         final Unit externalIcons(String names, String libraryName, Function1<ExternalIconBuilder, Unit> configure)

        Convenience overload for configuring multiple external icons from the same library.

        All icons will share the same URL template and style parameters.

        Examples:

        // Multiple icons from Bootstrap Icons
        externalIcons("bell", "house", "person", libraryName = "bootstrap-icons") {
            urlTemplate = "https://esm.sh/bootstrap-icons/fill/{name}.svg"
        }
        
        // Multiple icons with style parameters
        externalIcons("home", "search", "user", libraryName = "heroicons") {
            urlTemplate = "https://cdn.jsdelivr.net/npm/heroicons/{size}/{name}.svg"
            styleParam("size", "24")
        }
        
        // Multi-value style parameters for variants
        externalIcons("home", "search", "settings", libraryName = "official") {
            urlTemplate = "https://example.com/{name}_{fill}_24px.svg"
            styleParam("fill") {
                values("", "fill1")  // unfilled, filled variants
            }
        }
        Parameters:
        names - Icon names to configure
        libraryName - Library identifier shared by all icons
        configure - Configuration block applied to each icon
      • getConfigHash

         final String getConfigHash()

        Computes a deterministic hash for the current configuration.

        The hash is used to decide whether generateSymbolCraftIcons can reuse cached outputs.