New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-import-css

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-import-css - npm Package Compare versions

Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5

2

package.json
{
"name": "babel-plugin-transform-import-css",
"version": "1.0.0-alpha.4",
"version": "1.0.0-alpha.5",
"description": "Injects imported styles (css-modules) into js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,3 @@ Injects class map imported from css-modules into js.

# Requirements
babel == 6, node >= 8
babel == 7, node >= 8

@@ -14,3 +14,2 @@ babel and postcss configs for best results

npm add -SD babel-plugin-transform-import-css
npm add load-styles # puts styles into the head
```

@@ -23,11 +22,8 @@

"presets": [
["env", {
"targets": { "browsers": ["last 2 Chrome versions", "last 1 Safari version"] },
"useBuiltIns": false, "modules": false
}],
"stage-1", "react"
"@babel/env",
"react"
],
"plugins": [
["transform-import-css", {
"generateScopedName": "lib-[folder]-[name]-[local]-[hash:base64:4]"
"generateScopedName": "lib-[name]-[local]-[hash:base64:4]"
}]

@@ -38,9 +34,2 @@ ]

# Usage
The following command will convert everything in the `src` folder to `lib` using babel and our plugin.
babel src/ -d lib/ --presets stage-0,env,react --plugins transform-import-css
Every js file that has a statement such as:

@@ -50,5 +39,6 @@

import classes from './Component.css'
// ... some code
```
will be roughly translated to:
will be transpiled to:

@@ -58,5 +48,6 @@ ```js

root: 'lib-foo-root-SFs0',
// ...
// ... some classes ...
}
require('load-styles')('.root{color:red}') // puts styles into the head
require('load-styles')('.root{color:red}; ...some css...') // puts styles into the head
// ... some code
```

@@ -63,0 +54,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc