Created
January 2, 2017 22:28
-
-
Save dangayle/93b184a0dde66d43274bb5af42b8bbdf to your computer and use it in GitHub Desktop.
Loading Tachyons using Webpack and React
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
import React from 'react'; | |
import Tachyons from 'tachyons/css/tachyons.min.css' | |
const App = () => ( | |
<div className="mw9 center"> | |
<h2 className="red sans-serif tc">Hello, world</h2> | |
</div> | |
); | |
export default App; |
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
const path = require('path'); | |
const webpack = require('webpack'); | |
module.exports = { | |
context: path.resolve(__dirname, 'src'), | |
entry: [ | |
'react-hot-loader/patch', | |
'webpack-dev-server/client?http://localhost:8080', | |
'webpack/hot/only-dev-server', | |
'./index.js' | |
], | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist'), | |
publicPath: '/' | |
}, | |
devtool: 'inline-source-map', | |
devServer: { | |
hot: true, | |
contentBase: path.resolve(__dirname, 'dist'), | |
publicPath: '/' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: ['babel-loader'], | |
include: path.join(__dirname, 'src') | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
'style-loader', | |
'raw-loader' | |
], | |
} | |
] | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NamedModulesPlugin(), | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks