babel-plugin-css-in-js
Advanced tools
Comparing version
@@ -138,2 +138,5 @@ 'use strict'; | ||
var properties = Object.keys(sheet).reduce(function (memo, styleId) { | ||
if (styleId.charAt(0) === '$') { | ||
return memo; | ||
} | ||
return memo.concat(t.objectProperty(t.identifier(styleId), t.stringLiteral((0, _generateClassName2.default)(styleId, gcnOptions)))); | ||
@@ -140,0 +143,0 @@ }, []); |
@@ -86,3 +86,3 @@ 'use strict'; | ||
} else { | ||
(0, _assert2.default)(false, 'invalid value expression type'); | ||
(0, _assert2.default)(false, 'unexpected ' + value.type + ' at ' + value.loc.start.line + ':' + value.loc.start.column); | ||
} | ||
@@ -89,0 +89,0 @@ } |
@@ -48,3 +48,4 @@ 'use strict'; | ||
css.push(indent(level) + '.' + (0, _generateClassName2.default)(name, options) + ' {'); | ||
var selector = name.charAt(0) === '$' ? name.substring(1) : '.' + (0, _generateClassName2.default)(name, options); | ||
css.push(indent(level) + selector + ' {'); | ||
@@ -51,0 +52,0 @@ (0, _foreach2.default)(rules, function (value, key) { |
@@ -28,3 +28,3 @@ 'use strict'; | ||
var isStandaloneSelector = /^[:\[]/; | ||
var isValidStyleName = /^[_a-zA-Z]+[ _a-zA-Z0-9-]*[_a-zA-Z0-9-]*$/; | ||
var isValidStyleName = /^([_a-zA-Z]+[ _a-zA-Z0-9-]*[_a-zA-Z0-9-]*)|(\$[_a-zA-Z0-9-\s,\.]+)$/; | ||
@@ -163,3 +163,3 @@ function transformStyleSheetObjectIntoSpecification(content) { | ||
function initStyleSpec(styles, name) { | ||
(0, _assert2.default)(isValidStyleName.test(name), 'style name is invalid'); | ||
(0, _assert2.default)(isValidStyleName.test(name), 'style name is invalid: ' + name); | ||
@@ -166,0 +166,0 @@ styles[name] = styles[name] || { rules: {}, selectors: {}, mediaQueries: {} }; |
{ | ||
"name": "babel-plugin-css-in-js", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "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.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
46111
0.52%689
0.58%