blockly > Css > inject

Css.inject() function

Inject the CSS into the DOM. This is preferable over using a regular CSS file since: a) It loads synchronously and doesn't force a redraw later. b) It speeds up loading by not blocking on a separate HTTP transfer. c) The CSS content may be made dynamic depending on init options.

Signature:

export declare function inject(hasCss: boolean, pathToMedia: string): void;

Parameters

Parameter Type Description
hasCss boolean If false, don't inject CSS (providing CSS becomes the document's responsibility).
pathToMedia string Path from page to the Blockly media directory.

Returns:

void