Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ezavile/postcss-typescript-css-example

How to use postcss-typescript-css plugin with webpack 2, React, TypeScript and PostCSS
https://github.com/ezavile/postcss-typescript-css-example

css postcss postcss-plugin typescript

Last synced: 28 days ago
JSON representation

How to use postcss-typescript-css plugin with webpack 2, React, TypeScript and PostCSS

Awesome Lists containing this project

README

        

# postcss-typescript-css-example
How to use [postcss-typescript-css] plugin with webpack 2, React, TypeScript and PostCSS

This project has two components Card and Title. Each component has its own style file. The Card Component is using **postcss-modules**.

## Usage
### TitleComponent
**title.css** (I'm using [cssnext])
```css
.Title {
color: #444;
margin: 0;
&-description {
color: #acb2b5;
margin-bottom: 0;
}
}
```
**Title.tsx**
```javascript
import './title.css';
import { titleStyle } from './titleStyle';
```
So, titleStyle is an object with two properties:
```javascript
titleStyle = {
title: 'Title',
titleDescription: 'Title-description',
}
```
Now you can use it
```jsx

Welcome to postcss-typescript-css!


This is an example using the plugin with webpack 2, React, TypeScript and PostCSS


```
[postcss-typescript-css]: https://github.com/ezavile/postcss-typescript-css
[cssnext]: https://github.com/MoOx/postcss-cssnext