Configuration Reference

Coralite projects are configured using a coralite.config.js file placed at the root directory of your project.

1. The coralite.config.js File #

Use the defineConfig helper exported from coralite to construct and validate your project configuration:

javascript
Code copied!
  import { defineConfig } from 'coralite'
  
  export default defineConfig({
    output: 'dist',
    components: 'src/components',
    pages: 'src/pages',
    public: 'public',
    cleanUrls: true,
    viewTransitions: true,
    mode: 'production'
  })

2. Required Keys #

Every Coralite application requires three path configuration keys:

Key Type Description
output string Path to the destination directory where compiled static files are emitted (e.g. 'dist').
components string Path to the directory containing Coralite Web Components (e.g. 'src/components').
pages string Path to the directory containing application pages (e.g. 'src/pages').

3. Core Options #

Core options control asset delivery, URL routing formats, view transitions, and build modes:

Option Type Default Description
public string 'public' Directory containing static assets copied directly to the build root.
cleanUrls boolean true When true, outputs directory-style clean URLs (e.g. /about/index.html at route /about). When false, outputs file-style URLs (e.g. /about.html).
viewTransitions boolean true Enables native Same-Document View Transitions for client navigation.
mode 'production' | 'development' | 'testing' 'production' Build and execution environment mode.

4. Extended Options #

Extended configuration options allow declaring global store state, injecting stylesheets, registering plugins, and setting Content Security Policies:

5. Asset Injection #

The assets configuration array manages third-party library assets, copying files to the output directory and optionally injecting <script>, <link>, or <meta> tags with Subresource Integrity (SRI) hashes:

javascript
Code copied!
  import { defineConfig } from 'coralite'
  
  export default defineConfig({
    output: 'dist',
    components: 'src/components',
    pages: 'src/pages',
    assets: [
      {
        src: 'node_modules/lib/dist/lib.js',
        dest: 'assets/js/lib.js',
        inject: {
          type: 'script',
          placement: 'head-end',
          sri: true
        }
      }
    ]
  })

The inject option object supports configuration properties:

6. Test Fixtures & Page Exclusions #

To prevent test fixture pages from polluting your pages directory or ending up in production builds, configure the fixtures and exclude options:

javascript
Code copied!
  import { defineConfig } from 'coralite'
  
  export default defineConfig({
    output: 'dist',
    components: 'src/components',
    pages: 'src/pages',
  
    // Directory containing component test fixture pages:
    fixtures: 'tests/fixtures',
  
    // Or advanced configuration with fixture-only components and route prefix:
    // fixtures: {
    //   pages: 'tests/fixtures/pages',
    //   components: 'tests/fixtures/components',
    //   prefix: '/__fixtures__'
    // },
  
    // Optional glob patterns to exclude from page discovery:
    exclude: ['**/drafts/**']
  })

Key behaviors:

Start Building with Coralite!

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

Copied commandline!