Skip to content

helpers vs. inlinining the CSS directly into the templated string? #14

@resolritter

Description

@resolritter

when I was using this library for the first time, I thought the z.helper API was neat

however, can't the same be done by interpolating expressions directly into the string?

e.g., instead of

z.helper({
  bo: 'border'
})

z`
  bo 4 solid red
`

do

z`
  ${bo(4, 'solid', 'red')}
`

collateral benefit: also results in straightforward type-checking if you're using e.g. TypeScript

this could also be z.style in the "post-processing" phase for effects which depend on updated values (after a hook has triggered an update, for instance)


Is there some advantage I'm failing to see in there? My current impression is that those custom functions are more flexible and also would help in reducing the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions