Skip to content

Instantly share code, notes, and snippets.

@dangayle
Created January 2, 2017 22:28
Show Gist options
  • Save dangayle/93b184a0dde66d43274bb5af42b8bbdf to your computer and use it in GitHub Desktop.
Save dangayle/93b184a0dde66d43274bb5af42b8bbdf to your computer and use it in GitHub Desktop.
Loading Tachyons using Webpack and React
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;
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(),
],
}
@tonyalaribe
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment