martinandert / babel-plugin-css-in-js

A plugin for Babel v6 which transforms inline styles defined in JavaScript modules into class names so they become available to, e.g. the `className` prop of React elements. While transforming, the plugin processes all JavaScript style definitions found and bundles them up into a CSS file, ready to be requested from your web server.
MIT License
299 stars 11 forks source link

unknown node of type "NumberLiteral" with constructor "Node" when using numbers for values #1

Closed cly closed 8 years ago

cly commented 8 years ago

width: 80 used to work now it throws this error.

martinandert commented 8 years ago

Hi @cly, I cannot reproduce this. I tested with

var styles = cssInJS({ 
  foo: { 
    width: 80 
  } 
});

which transforms to

var styles = { 
  foo: "test-styles-foo"
};

and outputs

.test-styles-foo {
  width: 80px;
}

This is all expected.

Maybe you're using an outdated version of Babel somewhere else. Babel's changelog states that NumberLiteral was renamed to NumericLiteral in version 6.0.18.

cly commented 8 years ago

Aha I'm on 6.0.15.. thanks for a breaking change babel and not doing semver properly -__-.

Cool, that's helps a lot.