New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

css-module-flow-loader

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-module-flow-loader

css module flow loader

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

css-module-flow-loader

Build Status GitHub license npm version GitHub stars

Webpack loader for creating Flow type definitions based on CSS Modules files.

This gives you:

  • flow type safety showing usage of non existing classes
  • auto-completing for css files in most editors

How it works

Given the following css file using CSS Modules:

.my_class {
    display: block;
}

css-module-flow-loader creates the following .flow file next to it:

// @flow strict
/* This file is automatically generated by css-module-flow-loader */
declare module.exports: {|
    +'my_class': string;
|};

How to use

The css-module-flow-loader need to be added right after style-loader:

$ npm i -D css-module-flow-loader
{
  test: /\.css$/,  // or the file format you are using for your CSS Modules
  use: [
    'style-loader',
    'css-module-flow-loader',
    // other loaders here ...
  ]
}

Troubleshooting

Support for other file extensions

To support .scss, .sass or similar files extensions you need to update your .flowconfig file with the following section:

[options]
# Extensions
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.css
module.file_ext=.scss
module.file_ext=.sass
// other files used by flow

Without this Flow might error out with Required module not found.

Keywords

css

FAQs

Package last updated on 20 Sep 2020

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