#1945·postcss

Lazy Input.css

Author: nex3Created Jun 13, 2024Updated Jun 18, 2024

I'm looking into https://github.com/sass/dart-sass/issues/88, with the goal of exposing a PostCSS-compatible AST API (at least for statement-level AST nodes). One issue I'm running into is that Sass doesn't directly store the CSS text of the files it parses as a string. This means that creating a new `Input` object is relatively expensive, because we need to reconstruct the CSS file's text, even if the user is only ever accessing `node.source.input.from` as is reasonably common. It would be nice to have a way to make the css argument to `new Input()` be able to be lazy and only accessed when it's necessary.