Skip to content

Consider using a source generator to generate scoped css files  #7052

@pranavkm

Description

@pranavkm

The compiler is considering adding a feature that would allow source generators to produce additional artifacts that are written to disk. This would line up nicely with the rewriting CSS that Razor SDK currently performs to produce the final output for scoped css files. Reasons to consider this:

a) RewriteCss is the only command that is executed as part of the rzc command. By turning it into a source generator we would remove usages of rzc entirely from our build and consolidate all our previously out-of-process MSBuild operations into source generators

b) This might play nicely with hot reload that we want to support for scoped css files. Our current plan for supporting this involves launching msbuild as part of dotnet-watch to update these files.

c) We think it might improve build perf since it involves fewer separate process, less JITing involved (the compiler has to already load Razor dlls for razor code generation) etc.

Tentative docs for this feature: https://gist.github.com/CyrusNajmabadi/8cf5426f772ccf5e58bea7804c564cd4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions