generateLuau() function generates Luau source code from a compiled StyleSheetIR. The output is a module that returns a factory function creating a Roblox StyleSheet instance.
Signature
Parameters
The compiled intermediate representation from
compile(). See types for the full structureCode generation options
Returns
Generated Luau source code as a string. The module exports a
createStyleSheet() function that returns a configured StyleSheet instanceExample
Output structure
The generated Luau code follows this structure:Minified output
Whenminify: true, the output removes all comments and indentation:
Value serialization
Roblox values are serialized as follows:- Color3:
Color3.fromRGB(r, g, b)for properties,Color3.fromHex("#hex")for tokens - UDim2:
UDim2.new(xScale, xOffset, yScale, yOffset) - UDim:
UDim.new(scale, offset) - Enum:
Enum.<EnumType>.<Value> - Font:
Font.new("rbxasset://fonts/families/<family>.json", Enum.FontWeight.<weight>, Enum.FontStyle.<style>) - Vector2:
Vector2.new(x, y) - Token reference:
"$<tokenName>" - ColorSequence:
ColorSequence.new(...)with keypoints
Related
- compile() — Compile CSS to IR
- generateRBXMX() — Generate RBXMX format
- Types reference — Full type definitions