Skip to main content

extract_css_module_exports

Function extract_css_module_exports 

Source
pub fn extract_css_module_exports(
    source: &str,
    is_scss: bool,
) -> Vec<ExportInfo>
Expand description

Extract class names from a CSS module file as named exports.

For standard CSS, lightningcss parses the source into an AST and supplies the authoritative set of class-selector names; the byte-offset scanner then locates each name’s Span in the ORIGINAL source (pointing at the bare class name, no leading dot) so downstream compute_line_offsets resolves the real declaration line and column instead of falling back to line:1 col:0 (issue #549). For SCSS (Sass syntax lightningcss does not parse) and for any CSS that fails to parse outright, the regex-only scanner is used unchanged.