Skip to content

css #670

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

css #670

wants to merge 1 commit into from

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Feb 3, 2024

Fixes #666. Not sure there’s a lot of value here (especially relative to #597), but it’s easy to do. My silly test case:

```css
body {
  color: hsl(${x}, 50%, 50%);
}
```

```js
const x = Generators.observe((notify) => {
  notify(0);
  const pointermove = (event) => notify(event.clientX);
  addEventListener("pointermove", pointermove);
  return () => removeEventListener("pointermove", pointermove);
});
```

@mbostock mbostock requested a review from Fil February 3, 2024 18:22
@Fil
Copy link
Contributor

Fil commented Feb 5, 2024

The (very strong) upside of this is that we can add a CSS chapter to the documentation, instead of having CSS support be indirectly implied by the support for HTML in Markdown.

@mbostock
Copy link
Member Author

mbostock commented Feb 5, 2024

The downside is that the CSS is rendered client-side and so it’s more likely to cause a FOUC. I think if we fixed the parser I wouldn’t recommend this (though we could also figure out how to do this with server-side rendering so it’s equivalent to a style tag). 🤔

We could definitely document CSS now but we should also be careful not to try to teach everyone web development from scratch.

@mbostock mbostock marked this pull request as draft February 10, 2024 19:48
@mbostock
Copy link
Member Author

We could server-side render the CSS (like we do with PRQL in #1078). And if there are interpolations, we could additionally have JavaScript to update the CSS dynamically (perhaps more selectively than we currently do? like we could only allow interpolations into CSS values rather than arbitrary chunks of CSS).

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 this pull request may close these issues.

CSS code blocks
2 participants