Skip to content

Custom Compiler

Use createCompiler for custom build systems.

For build systems that do not fit the provided adapters, use the compiler entrypoint:

import { createCompiler } from '@fluentic/style/compiler';
const compiler = createCompiler({
extract: true,
});
const result = compiler.transform(sourceCode, filePath);
if (result) {
console.log(result.code);
console.log(result.css);
}

The compiler transform result contains:

type CompilerTransformResult = {
code: string;
map: string | null;
css: string[];
};

Use this only if you are writing tooling. Application users should prefer a bundler adapter.