ezavile / postcss-typescript-css-example

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

Home Page:http://postcss-typescript-css.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

.Title {
  color: #444;
  margin: 0;
  &-description  {
    color: #acb2b5;
    margin-bottom: 0;
    }
}

Title.tsx

import  './title.css';
import { titleStyle } from  './titleStyle';

So, titleStyle is an object with two properties:

titleStyle  =  {
  title: 'Title',
  titleDescription: 'Title-description',
}

Now you can use it

<h1 className={titleStyle.title}>Welcome to postcss-typescript-css!</h1>
<h3 className={titleStyle.titleDescription}>This is an example using the plugin with webpack 2, React, TypeScript and PostCSS</h3>

About

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

http://postcss-typescript-css.herokuapp.com/

License:MIT License


Languages

Language:JavaScript 53.3%Language:TypeScript 38.4%Language:HTML 7.5%Language:CSS 0.8%