CSS #

There are a few different ways of customising your Module's CSS, each with their pros and cons.

Template File #

CastHub Modules can supply a Template HTML File which can include CSS inside of it. This is the easiest way to include and manage CSS in a CastHub Module. You can read the Documentation here.

Embedded in JavaScript #

A lower-level method of adding CSS to your Module is via the css property within your Module. For example:

module.exports = class extends window.casthub.module {

    /**
     * Initialise the new Module.
     */
    constructor() {
        super();

        // Set the CSS for the Module.
        this.css = `
            .module {
                display: flex;
            }
        `;
    }

};

Building/Preprocessors #

A combination of a build process and the previous in-module CSS, you can use a build process like Rollup to export a Module that pre-imports the required CSS/SCSS/LESS/etc. file. For more information on this, check out our Boilerplate Documentation.