Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser handles parsing JS/TS to extract CSS from tagged template literals
func (*Parser) ParseCSS ¶
func (p *Parser) ParseCSS(source string) (*css.ParseResult, error)
ParseCSS extracts and parses CSS from tagged template literals in JS/TS source
func (*Parser) ParseTemplates ¶
func (p *Parser) ParseTemplates(source string) []TemplateRegion
ParseTemplates finds css/html tagged template literals and splits them at ${...} boundaries. Handles both standard form (css`...`) and generic form (css<Type>`...`).
type Segment ¶
type Segment struct {
// Content is the literal text of this segment
Content string
// StartLine is the 0-indexed line in the JS/TS source where this segment begins
StartLine uint
// StartCol is the 0-indexed column in the JS/TS source where this segment begins
StartCol uint
}
Segment represents a literal text segment from a template string, between ${...} expression boundaries
type TemplateRegion ¶
type TemplateRegion struct {
// Segments contains the literal text parts of the template, split at ${...} boundaries
Segments []Segment
// Tag is the template tag function name ("css" or "html")
Tag string
}
TemplateRegion represents a tagged template literal found in JS/TS source
Click to show internal directories.
Click to hide internal directories.