feathersui-openfl icon indicating copy to clipboard operation
feathersui-openfl copied to clipboard

Haxedef feathersui_disable_default_theme should prevent UI components from initializing their default styles

Open joshtynjala opened this issue 2 years ago • 2 comments

Currently, it keeps Theme.fallbackTheme from being initialized, but code like this still keeps a number of classes in the compiled output that don't need to be there:

private function initializeButtonTheme():Void {
	SteelButtonStyles.initialize();
}

Should just be a matter of adding conditional compilation:

private function initializeButtonTheme():Void {
	#if !feathersui_disable_default_theme
	SteelButtonStyles.initialize();
	#end
}

joshtynjala avatar Jun 23 '22 17:06 joshtynjala

I tried simply adding !feathersui_disable_default_theme around the initialize calls (could do that with a regex, thanks to naming consistency), but that doesn't seem to be enough to not have the classes in the output, unless we turn DCE on full. I assume this is because a mere import is making the module included in the compilation. So I guess we also have to fence the imports?

Also, with dce=full, the RectangleSkin somehow ends up in the output, even though it's not referenced by any of the compiled code, but I guess that's more of a Haxe issue.

nadako avatar Jun 23 '22 18:06 nadako

I assume this is because a mere import is making the module included in the compilation. So I guess we also have to fence the imports?

Or use the fully-qualified name instead of importing.

joshtynjala avatar Jun 23 '22 18:06 joshtynjala