forked from jcreamer898/gatsby-plugin-typescript-css-modules
-
Notifications
You must be signed in to change notification settings - Fork 4
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
bc5b268
commit f60b136
Showing
4 changed files
with
56 additions
and
73 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 |
---|---|---|
@@ -1,27 +1,28 @@ | ||
[![Build Status](https://travis-ci.org/jcreamer898/gatsby-plugin-typescript-css-modules.svg?branch=master)](https://travis-ci.org/jcreamer898/gatsby-plugin-typescript-css-modules) | ||
## Forked From | ||
|
||
# Gatsby Plugin Typescript CSS Modules | ||
This [GatsbyJS](gatsbyjs.org) plugin allows for using TypeScript along side CSS Modules. | ||
[https://github.com/jcreamer898/gatsby-plugin-typescript-css-modules](https://github.com/jcreamer898/gatsby-plugin-typescript-css-modules) | ||
|
||
It requires you to name your css files as `page.module.css`, but from there you can import them into TS files. | ||
# Gatsby Plugin Typescript CSS Modules | ||
This [GatsbyJS](gatsbyjs.org) plugin adds [typings-for-css-modules-loader](https://github.com/Jimdo/typings-for-css-modules-loader) to your configuration | ||
|
||
Import styles normally | ||
```ts | ||
import * as styles from "./page.module.css"; | ||
``` | ||
|
||
The way this works is, under the covers the https://github.com/Jimdo/typings-for-css-modules-loader WebPack plugin reads the CSS file and generates a `.d.ts` file alongside your css. | ||
and typings-for-css-modules-loader will read the CSS file and generates a `.d.ts` file alongside your css. | ||
|
||
### Installing | ||
First, install the plugin... | ||
|
||
```bash | ||
npm i gatsby-plugin-typescript-css-modules | ||
npm i gatsby-transformer-typescript-css-modules --save | ||
``` | ||
|
||
Then, add the plugin to your `gatsby-config.js`... | ||
|
||
```js | ||
// ... | ||
"gatsby-plugin-typescript-css-modules" | ||
"gatsby-transformer-typescript-css-modules" | ||
] | ||
``` |
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 was deleted.
Oops, something went wrong.