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

style files still bundled #4

Open
derhuerst opened this issue Oct 16, 2016 · 2 comments
Open

style files still bundled #4

derhuerst opened this issue Oct 16, 2016 · 2 comments

Comments

@derhuerst
Copy link

First of all: Thanks for this pretty elegant way of having CSS in JS!

I used csjs-extractify and the css files generated are correct. But the css is still inside the browserify bundle. Therefore the JS bundle will still be the same size (plus the generated CSS) and there will also be a runtime overhead.

This following behaviour is what i would have expected.

// foo.csjs.js
const csjs = require('csjs')
module.exports = csjs `
  .foo { color: red; }
  .bar { color: blue; }
`
// foo.csjs.js inside the JS bundle
module.exports = {
  foo: '.foo_12k4'
  bar: '.bar_ij5t'
`
@rtsao
Copy link
Owner

rtsao commented Oct 16, 2016

Yeah, this is a known issue and was one of the things brought up in #3 but it's somewhat difficult to do statically at build-time. That said, what you are describing is definitely possible to do but I haven't had a chance to implement it yet 👍

@derhuerst
Copy link
Author

derhuerst commented Oct 17, 2016

I agree that it's not possible with static analysis in every possible way the code might look like. Once this is implemented, there should be a note on that in the readme that you can only access the class names after transpiring, not more.

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

No branches or pull requests

2 participants