rtsao / csjs

:sparkles: Modular, scoped CSS with ES6
MIT License
576 stars 32 forks source link

Using with browserify+babelify doesn't add styles #46

Open knownasilya opened 8 years ago

knownasilya commented 8 years ago

I also tried csjs-extractify but it creates a blank CSS file. Is there a way to get it to work?

rtsao commented 8 years ago

csjs-extractify needs to run before babelify. I suspect this is what is happening:

csjs`.foo {}`

is being turned into:

"use strict";

var _templateObject = _taggedTemplateLiteral([".foo {}"], [".foo {}"]);

function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }

csjs(_templateObject);

Which csjs-extractify won't recognize.

knownasilya commented 8 years ago

Thanks! Will give it a try!