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

auto-modules-css-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-modules-css-loader

A wrapped css-loader that automatically toggles CSS Modules feature

1.0.0
latest
Source
npm
Version published
Weekly downloads
4
-42.86%
Maintainers
1
Weekly downloads
 
Created
Source

auto-modules-css-loader

This loader is just a wrapper around css-loader. It provides only one extra feature: auto detects if CSS Modules is used from your source code and toggles the modules option for you.

IMPORTANT! auto-modules-css-loader only handles the modules option, all other options are naively passed down to css-loader. Please consult their docs for configuration details.

Usage

css-loader is specified as a peer dependency. You'll need to install it first.

Then simple replace css-loader with auto-modules-css-loader and you're good to go.

var webpackConfig.module.rules = [
  {
    test: /\.css$/,
    use: [{
-     loader: 'css-loader',
+     loader: 'auto-modules-css-loader',
      options: { /* ... */ }
    }]
  }
]

Now in your source code, both side-effect imported stylesheet and CSS Module stylesheet would work as expected.

import './my-plain-stylesheet.css'
import style from './my-css-module-stylesheet.css'

// Note that you still need to manually add the `camcelCase` option
// if you prefer to use camel case locals.
// `auto-modules-css-loader` doesn't config that for you.
function App() {
  return <div className={style.myClassName} >hello</div>
}

FAQs

Package last updated on 21 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts