Skip to main content

Configuration Reference

Coralite is configured using a coralite.config.js file in the root of your project. This file exports a configuration object that defines input paths, output directories, plugins, and build options.

If you prefer TypeScript or type hinting, you can use the defineConfig helper from coralite-scripts.

javascript
Code copied!
  // coralite.config.js
  import { defineConfig } from 'coralite-scripts';
  import myPlugin from './plugins/my-plugin.js';
  
  export default defineConfig({
    components: 'src/components',
    pages: 'src/pages',
    output: 'dist',
    plugins: [myPlugin],
    onError: ({ level, message, error }) => {
      if (level === 'ERR') {
        console.error(`[FATAL] ${message}`);
        if (error) console.error(error.stack);
      } else {
        console.warn(`[${level}] ${message}`);
      }
    }
  });

Configuration Options #

The CoraliteConfig object accepts the following properties:

Property Type Default Description
components string - Path to the directory containing Coralite component files.
pages string - Path to the directory containing page files.
output string - Path to the output directory.
plugins CoralitePluginInstance[] [] Array of plugin instances to register.
assets CoraliteStaticAsset[] [] Static assets to copy during build. See Static Assets Plugin.
baseURL string '/' Base URL for asset paths.
ignoreByAttribute IgnoreByAttribute[] [] Elements to ignore by attribute name-value pair during parsing.
skipRenderByAttribute string[] [] Attribute names that trigger elements to be excluded from the final render.
onError CoraliteOnError Default handler Callback for handling errors and warnings.
mode 'production' | 'development' 'production' Build mode.

Error & Warning Handling (onError) #

Coralite provides a centralized onError callback in its configuration to handle framework-level issues.

The API Signature

The onError callback receives a single structured error object containing:

The Default Behavior

If omitted, Coralite defaults to using console.warn and console.log for warnings and logs. However, for level 'ERR', the default handler throws an actual Error with the provided message to intentionally break the build pipeline if an unrecoverable issue occurs.

Environment Considerations #

When running Coralite using the coralite-scripts development mode (e.g., npm run dev or mode === 'development'), the output directory is automatically overridden to a temporary .coralite/build folder to isolate build artifacts from production outputs.

Start Building with Coralite!

Use the scaffolding script to get jump started into your next project with Coralite

Copied commandline!