Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CSS variables instead of writing to the CSS template #28

Closed
gadenbuie opened this issue Aug 17, 2022 · 0 comments · Fixed by #36
Closed

Use CSS variables instead of writing to the CSS template #28

gadenbuie opened this issue Aug 17, 2022 · 0 comments · Fixed by #36
Milestone

Comments

@gadenbuie
Copy link
Owner

(Even using {sass} would be better.)

I do something a little unusual in countdown and write the CSS file on the fly for the first timer included in the document. That's why you get a message about a file in the temp dir when using cache: true in Quarto (or cache = TRUE in knitr), since the temp directory changes between sessions and the CSS resources for countdown aren't found where they're supposed to be.

That's a design decision from my very early days learning htmltools; these days I would use CSS variables to avoid this problem.

Originally posted by @gadenbuie in #27 (comment)

I think what I'd want to do, to maintain the countdown() function arguments, would be to replace the whisker template variables with CSS variables and then include the CSS variables in the head of the htmlDependency(). Pretty sure that would cache correctly and still work with the first-definition-wins approach.

Actually, the variables (for non-missing arguments) could be set within each timer so that you could still use the color and style arguments to overwrite individual timers. 🤔

@gadenbuie gadenbuie added this to the v0.5.0 milestone Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant