fast icon indicating copy to clipboard operation
fast copied to clipboard

feat: provide `html.partial` and `css.partial` as standalone tagged template literals

Open radium-v opened this issue 1 year ago • 0 comments

🙋 Feature Request

It would be very convenient to provide the html.partial() and css.partial methods as tagged template literal functions. Perhaps both the methods and the tagged template literal functions could coexist:

// Since `css.partial` is already a TTL, it can be reflected
export const cssPartial = css.partial;

// `html.partial` only accepts one string so it has to be transformed
export const htmlPartial = (strings: TemplateStringsArray, ...values: any[]) => html.partial(strings[0]);

🔦 Context

The css.partial and html.partial() methods can't be compressed at build-time with most tagged template literal optimization methods, which usually work by identifying a tagged template literal via an AST. Our current solution is a rollup plugin which accepts an array of tags to optimize, but the AST implementation only sees partial and not the full css.partial or html.partial.

radium-v avatar May 15 '24 23:05 radium-v