You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract css class names from required css module files for TypeScript. This plugin is based on css-modules-require-hook and so constructor opts are from that repo.
This allows you to do this in TS files:
// Import worksimport*ascssfrom'foo.css'// require also worksconstfoo=require('foo.css')console.log(css.foo)
Append this to before in your compilation step. See compile.ts for more info.
Right now named imports will not work due to TS mangling import name after compilation.
// Those are NOT workingimportcssfrom'foo.css'import{button,badge}from'foo.css'
tsImportResolver (path: string): string: This callback function allows you to override import path in ImportDeclaration for every CSS file we encounter. This is useful when dealing with project that uses paths aliases in tsconfig. This might not be necessary once microsoft/TypeScript#28276 is resolved.
Caveats
Source map support might not be entirely accurate
About
Extract css class names from required css module files for TypeScript