danieldelcore / danieldelcore/trousers

Build-time optimisations via Bable-macros

Open
#67 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
299
Forks
4
PR merge metrics
No merged PRs in 30d

Description

We should look into this as a way to reduce runtime costs!
And set us up for zero-config SSR:

https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros

so using the babel macro we could go from this:

```tsx
/** @jsx jsx */
import { css, jsx} from '@trousers/core'

const styles = css`
color: white;
`;

const Button = props => {
const classNames = useStyles(styles, props);

return {props.children};
};

export default Button;
```

to this:

```tsx
/** @jsx jsx */
import { css, jsx} from '@trousers/macro'

const styles = css`
color: white;
`;

const Button = props => {
return {props.children};
};

export default Button;
```

- So we'll swap our JSX pragma for one that can support zero runtime
- Allows us to keep the current API for people who don't want to opt into the CSS prop etc
- Perform optimisations on the CSS like
- Removing comments
- Vendor prefixing
- Other cool stuff?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.