babel-plugin-react-scoped-css
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -50,3 +50,6 @@ // @ts-check | ||
JSXElement(path, stats) { | ||
if (!this.hasScopedCss) { | ||
if ( | ||
!this.hasScopedCss || | ||
path.node.openingElement.name.type === 'JSXMemberExpression' | ||
) { | ||
return | ||
@@ -58,4 +61,4 @@ } | ||
t.jsxIdentifier(`data-v-${hash}`), | ||
t.jsxExpressionContainer(t.stringLiteral('')) | ||
) | ||
t.jsxExpressionContainer(t.stringLiteral('')), | ||
), | ||
) | ||
@@ -62,0 +65,0 @@ }, |
{ | ||
"name": "babel-plugin-react-scoped-css", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "index.js", | ||
@@ -19,3 +19,3 @@ "license": "MIT", | ||
], | ||
"gitHead": "f5c773d20072818bb68d376ff2192b33557ed32f" | ||
"gitHead": "5edcd58f6b82bade9cf8a72e7045ab8b4d3d9ad3" | ||
} |
@@ -93,4 +93,25 @@ # React scoped CSS | ||
## Some common use cases with scoped css | ||
## Some common use cases with react scoped css | ||
Check out [simple-scoped-css-example](https://github.com/gaoxiaoliangz/react-scoped-css/tree/master/examples/simple) | ||
## Use scoped css in create react app | ||
Due to the fact that create react app doesn't allow user to modify the config of webpack or babel, I created my own fork of a configurable version of it. You can find it [here](https://github.com/gaoxiaoliangz/create-react-app/tree/master/packages/react-scripts). | ||
### Use in a new create-react-app project | ||
``` | ||
create-react-app app_name --scripts-version=@gxl/react-scripts | ||
``` | ||
and you are good to go, react scoped css is supported by default | ||
### Use in an existing create-react-app project (which hasn't been ejected yet) | ||
``` | ||
npm install @gxl/react-scripts --save-dev | ||
npm remove react-scripts | ||
``` | ||
and next time you start your project you're bootstrapping from @gxl/react-scripts |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6953
4
60
117