-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5e8e6c
commit 0bd735f
Showing
7 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type { Plugin } from 'esbuild'; | ||
|
||
declare type GenerateScopedNameFunction = ( | ||
name: string, | ||
filename: string, | ||
css: string | ||
) => string; | ||
|
||
declare type LocalsConventionFunction = ( | ||
originalClassName: string, | ||
generatedClassName: string, | ||
inputFile: string | ||
) => string; | ||
|
||
declare interface CssModulesOptions { | ||
getJSON?(cssFilename: string, json: { [name: string]: string }, outputFilename?: string): void; | ||
|
||
localsConvention?: | ||
| 'camelCase' | ||
| 'camelCaseOnly' | ||
| 'dashes' | ||
| 'dashesOnly' | ||
| LocalsConventionFunction; | ||
|
||
scopeBehaviour?: 'global' | 'local'; | ||
globalModulePaths?: RegExp[]; | ||
|
||
generateScopedName?: string | GenerateScopedNameFunction; | ||
|
||
hashPrefix?: string; | ||
exportGlobals?: boolean; | ||
root?: string; | ||
|
||
Loader?: typeof Loader; | ||
|
||
resolve?: (file: string) => string | Promise<string>; | ||
} | ||
|
||
declare interface PluginOptions { | ||
inject?: boolean; | ||
localsConvention?: CssModulesOptions['localsConvention']; | ||
generateScopedName?: CssModulesOptions['generateScopedName']; | ||
cssModulesOption?: CssModulesOptions; | ||
v2?: boolean; | ||
} | ||
|
||
export default function CssModulesPlugin(options?: PluginOptions): Plugin; | ||
|
||
export = CssModulesPlugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import React from 'react'; | ||
import styles, * as appCssModules from '../styles/app.modules.css'; | ||
import styles2, * as h from '../styles/deep/styles/hello.modules.css'; | ||
|
||
export const HelloWorld = () => <> | ||
<h3 className={styles.helloWorld}>Hello World!</h3> | ||
{ | ||
appCssModules.digest && <pre><code>${appCssModules.digest}</code></pre> | ||
} | ||
{ | ||
appCssModules.css && <pre><code>${appCssModules.css}</code></pre> | ||
} | ||
</> | ||
export const HelloWorld = () => ( | ||
<> | ||
<h3 className={styles.helloWorld}>Hello World!</h3> | ||
<p className={styles2.helloText}>hi...</p> | ||
<pre> | ||
<code>${appCssModules?.digest ?? '// n/a'}</code> | ||
</pre> | ||
<pre> | ||
<code>${h?.digest ?? '// n/a'}</code> | ||
</pre> | ||
<pre> | ||
<code>${h?.css ?? '// n/a'}</code> | ||
</pre> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.hello-text { | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters