Skip to content

Search titles, headings, and documentation content.

↑↓ navigate Enter open Esc close

    Browse documentation
    On this page

    Project configuration

    Sklair reads sklair.json from the current directory, falling back to src/sklair.json. All configured paths are resolved relative to the directory containing that file.

    {
      "$schema": "https://github.com/numelon-oss/sklair/releases/latest/download/sklair.schema.json",
      "input": ".",
      "components": "components",
      "layouts": "layouts",
      "hooks": {
        "enabled": true,
        "path": "hooks"
      },
      "output": "../build",
      "templates": ["AudioTier"]
    }
    

    Fields

    Field Type Default Description
    $schemastring"https://github.com/numelon-oss/sklair/releases/latest/download/sklair.schema.json"Sklair configuration file schema. This is usually automatically populated with whichever Sklair version created the project.
    inputstring"./src"The directory where the project's source code is stored.
    componentsstring"./components"The directory where the project's components are stored.
    layoutsstring"./layouts"The directory where the project's full-document layouts are stored.
    outputstring"./build"The directory where the built project should be written.
    excludestring[][]A list of gitignore-style glob patterns that should be excluded from the build process.
    excludeCompilestring[][]A list of gitignore-style glob patterns that should be excluded from the compilation process.
    templatesstring[][]Components that compile into native browser templates when used in a document. Sklair Runtime is not included if this field is omitted.
    serveobject{ ... }Development server options.
    serve.rewritesobject[][]Ordered development-server path rewrites. Generated files take precedence over rewrites.
    hooksobject{ ... }Sandboxed Lua pre- / post-build hook options.
    hooks.enabledbooleanfalseWhether sandboxed Lua pre- / post-build hooks should be executed.
    hooks.pathstring"hooks"The directory where pre- / post-build hooks are stored. The directory must contain the directories "pre" and "post".
    hooks.httpobject{ ... }HTTP(s) request options for pre- / post-build hooks.
    hooks.http.httpAllowedbooleanfalseWhether HTTP requests should be allowed in pre- / post-build hooks.
    hooks.http.allowedHostsstring[][]A list of hosts that are allowed to make HTTP(s) requests in pre- / post-build hooks.
    hooks.http.allowedMethodsstring[][]A list of methods that are allowed to be used in pre- / post-build hooks.
    hooks.http.maxResponseBytesinteger2097152The maximum size of a response that can be received from a hook, in bytes.
    hooks.http.timeoutinteger5000The maximum time in milliseconds that a HTTP(s) request within a hook can take to respond.
    hooks.http.followRedirectsbooleantrueWhether HTTP(s) redirects should be followed within a hook.
    hooks.http.maxRedirectsinteger5The maximum number of redirects that can be followed by a HTTP(s) request within a hook.
    preventFOUCobject{ ... }Options for preventing Flash Of Unstyled Content (FOUC) in the resulting HTML.
    preventFOUC.enabledbooleanfalseWhether Sklair should help prevent Flash Of Unstyled Content (FOUC).
    preventFOUC.colourstring"#202020"The colour of the FOUC prevention overlay, shown before the page is fully loaded.
    minifybooleanfalseWhether HTML files should be minified. TODO: feature
    obfuscateJSobject{ ... }Options reserved for JavaScript obfuscation. TODO: feature. perhaps sklair extensions for both obfuscation and minification; dont include in sklari core
    obfuscateJS.enabledbooleanfalseWhether JavaScript files should be obfuscated. TODO: this is a future feature

    HTML extensions .htm, .html, .shtml, and .xhtml are compiled. Other discovered files are copied. excludeCompile reclassifies matching HTML as a static file; exclude removes a match entirely.

    Patterns follow gitignore-style doublestar matching, including ! re-inclusion, leading / anchoring, and directory matching. Sklair also excludes its configuration file, .sklair, Git and common editor metadata, environment files, node_modules, macOS metadata, and configured component, layout, hook, and output directories.

    hooks

    {
      "hooks": {
        "enabled": true,
        "path": "hooks"
      }
    }
    

    path defaults to hooks; Sklair discovers .lua files beneath its pre and post directories. The nested hooks.http shape is present in the configuration schema for future HTTP support, but no HTTP module is currently exposed to hooks. Setting those fields does not enable requests.

    preventFOUC

    {
      "preventFOUC": {
        "enabled": true,
        "colour": "#f5f2ed"
      }
    }
    

    When enabled, Sklair inserts an early style which hides the document against the configured colour and a body script which reveals it on window load, aiming to prevent a Flash Of Unstyled Content (FOUC). The default colour is #202020.

    serve

    serve.rewrites is an ordered array of { "from": "request pattern", "to": "/output-file.html" } rules. Both fields are required. Existing output files take precedence, and the first matching rule serves its target for GET and HEAD requests.

    This is development-server configuration only. See SPA path rewrites for syntax, examples, and fallback behaviour.