babel-plugin-jss-simple
Advanced tools
Comparing version 0.2.0 to 0.2.2
@@ -14,9 +14,7 @@ 'use strict'; | ||
var CallVisitor = { | ||
CallExpression: function CallExpression(path, _ref2) { | ||
var name = _ref2.name; | ||
CallExpression: function CallExpression(path, state) { | ||
var node = path.node; | ||
if (node.callee.name === name && node.arguments.length === 1) { | ||
path.replaceWith(t.callExpression(t.identifier(name), [node.arguments[0], t.identifier('__filename')])); | ||
if (node.callee.name === state.name && node.arguments.length === 1) { | ||
path.replaceWith(t.callExpression(t.identifier(state.name), [node.arguments[0], t.binaryExpression('+', t.identifier('__filename'), t.stringLiteral('_' + state.idx++))])); | ||
} | ||
@@ -35,3 +33,3 @@ } | ||
if (t.isImportDefaultSpecifier(spec)) { | ||
path.parentPath.traverse(CallVisitor, { name: spec.local.name }); | ||
path.parentPath.traverse(CallVisitor, { name: spec.local.name, idx: 1 }); | ||
} | ||
@@ -38,0 +36,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/ashaffer/babel-plugin-jss-simple.git", | ||
"version": "0.2.0", | ||
"version": "0.2.2", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "lib/index.js", |
@@ -35,3 +35,3 @@ | ||
} | ||
}) | ||
}, __filename) | ||
``` | ||
@@ -47,4 +47,8 @@ | ||
## Can I use `css` more than once in a given file? | ||
Yes. Each instance of the call will be keyed separately, with `_<n>` being suffixed to the file name key. | ||
## License | ||
MIT |
3304
53
46