rtsao / csjs

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

generate duplicate styling code #27

Closed bigopon closed 8 years ago

bigopon commented 8 years ago

Hi,

When I use csjs on

var style = csjs`
.a { float: right }
`

I get the result

var _templateObject = _taggedTemplateLiteral(["\n.a { float: right }\n"], ["\n.a { float: right }\n"]);

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

    var style = csjs(_templateObject);

I'm not sure if it's only me.

rtsao commented 8 years ago

I'm not quite sure what your issue is, that's just how Babel transpiles tagged template strings. For example: https://babeljs.io/repl/#?evaluate=true&presets=es2015&experimental=true&loose=false&spec=false&playground=false&code=function%20foo()%20%7B%0A%20%20console.log(arguments)%3B%0A%7D%0A%0Avar%20bar%20%3D%20foo%60hello%20world%60%3B

bigopon commented 8 years ago

Ok thanks then. I'll close this