Skip to content

@gluonjs/core / packages/compiler/src / GluonSfcBlock

Interface: GluonSfcBlock ​

Properties ​

attributes ​

readonly attributes: Readonly<Record<string, string | true>>


content ​

readonly content: string


end ​

readonly end: number


range ​

readonly range: Readonly<{ end: number; start: number; }>


start ​

readonly start: number


type ​

readonly type: "template" | "style" | "script"

Example ​

Inspect a readonly parsed block and its original source range:

ts
import { parseGluonSfc, type GluonSfcBlock } from '@gluonjs/compiler';

const block: GluonSfcBlock | undefined = parseGluonSfc('<style id="card">.card {}</style>', 'Card.gluon').blocks[0];
console.log(block?.type, block?.attributes, block?.range);

Version-matched documentation. Examples are checked against the public package contracts.