Skip to main content

Function: inject()

function inject(
container,
hasCss,
pathToMedia
): void;

Defined in: packages/blockly/core/css.ts:34

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.

Parameters

ParameterTypeDescription
containerHTMLElementThe div or other HTML element into which Blockly was injected.
hasCssbooleanIf false, don't inject CSS (providing CSS becomes the document's responsibility).
pathToMediastringPath from page to the Blockly media directory.

Returns

void