Update aphrodite #28

Merged
merged 2 commits into from Jun 6, 2016

Projects

None yet

2 participants

@kentcdodds
Contributor

Aphrodite supports server side rendering which means generating a CSS file is trivial. Also, it does autoprefixing.

@kentcdodds kentcdodds Update aphrodite
Aphrodite supports server side rendering which means generating a CSS file is trivial. Also, it does autoprefixing.
0e72f41
@MicheleBertoli
Owner

Hello @kentcdodds, thank you very much for your PR!

I'm sorry for the missing features but when I added the library to the repo (v0.1.2), the autoprefixing wasn't published yet.
It would be great if you could also upgrade the library on the example and the version on the readme.

"Extract CSS File" means being able to export a plain CSS file at build time (that can be pushed on a CDN, for example) and, as far as I understand, aphrodite doesn't support that.
It is obviously possible to generate a file using renderStatic but that's different.
Am I wrong?

@kentcdodds
Contributor

Hi @MicheleBertoli!
I'll be happy to update the example as well.

As for "Extract CSS File" it may be a little loosy-goosy. It's totally possible to do and it's straightforward. It just takes a little work on the part of the developer. It pretty much amounts to a simple call like this:

const {css} = StyleSheetServer.renderStatic(() => {
  // do all your aphrodite.css calls in this callback
  // In a universal react app, this would be something like:
  // ReactDOMServer.renderToStaticMarkup(<Root />)
  // and all the `css` calls would be in the `render` method
})
fs.writeFileSync('./path/to.css', css.content)

For an example, the JavaScriptAir.com website does this to generate all of its pages (resulting in a 100% static site with basically 0 JS shipped to the browser).

@kentcdodds
Contributor

I've updated my PR to update all dependencies and added a script that will generate a css file (just for demonstration purposes).

@MicheleBertoli MicheleBertoli merged commit c31cc6c into MicheleBertoli:master Jun 6, 2016
@MicheleBertoli
Owner

Awesome @kentcdodds, thanks!

@kentcdodds kentcdodds deleted the kentcdodds:patch-1 branch Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment