Skip to content

Commit

Permalink
feat (react-css-modules) implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
grrseguin committed Jun 29, 2016
1 parent 4f13643 commit a307c3e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ReactJS & webpack starter for Github issues

## Installation
```
npm install
```

## Get started
```
npm start
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<link rel='stylesheet' href='./bin/app.css'>
</head>
<body>
<div id="content"></div>
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
"main": "index.js",
"dependencies": {
"react": "^15.1.0",
"react-css-modules": "^3.7.6",
"react-dom": "^15.1.0"
},
"devDependencies": {
"babel-core": "^6.10.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"style-loader": "^0.13.1",
"webpack": "^1.13.1",
"webpack-dev-server": "^1.14.1"
},
Expand Down
3 changes: 3 additions & 0 deletions src/components/Title.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.title {
color: yellow;
}
7 changes: 5 additions & 2 deletions src/components/Title.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React from 'react';
import CSSModules from 'react-css-modules';
import styles from './Title.css';


var Title = React.createClass({
render: function() {
return (
<h1 className="commentBox">
<h1 styleName='title'>
Hello, world! I am a title.
</h1>
);
}
});

export default Title;
export default CSSModules(Title, styles);
17 changes: 16 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
var
webpack = require('webpack'),
ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = {
entry: './src/app.js',
output: {
path: './bin',
filename: 'app.bundle.js'
filename: 'app.bundle.js',
publicPath: '/bin/'
},
plugins: [
new ExtractTextPlugin('app.css', {
allChunks: true
}),
new webpack.NoErrorsPlugin()
],
module: {
loaders:[
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]')
}
]
}
Expand Down

0 comments on commit a307c3e

Please sign in to comment.