Skip to content

Instantly share code, notes, and snippets.

@simenbrekken
Last active August 29, 2015 14:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simenbrekken/ced1e127fa947467d2b4 to your computer and use it in GitHub Desktop.
Save simenbrekken/ced1e127fa947467d2b4 to your computer and use it in GitHub Desktop.
React in the Real World

Slides

You can find the slides to my talk here, the links to Anton Sport have been removed as the site isn't quite ready for the public yet.

Libraries

Webpack

Creating a comfortable development enviroment with Webpack took me a long time to get right so I thought I'd share an example config, which is attached to this Gist.

To start a local development server:

$ npm install -g webpack-dev-server
$ webpack-dev-server --hot

Now simply access http://localhost:8080/webpack-dev-server/client

var config = {
entry: {
client: ['./src/styles/index.styl', './src/scripts/index.js']
},
output: {
path: __dirname + '/build/public',
filename: '[name].js',
publicPath: '/'
},
module: {
loaders: [
{test: /\.jsx$/, loader: 'react-hot!jsx'},
{test: /\.styl$/, loader: 'style!css?disableStructuralMinification!autoprefixer!stylus'},
{test: /\.(eot|ttf|woff)$/, loader: 'file?name=fonts/[name]-[hash:6].[ext]'},
{test: /\.png$/, loader: 'file?name=images/[name]-[hash:6].[ext]'},
{test: /\.svg$/, loader: 'raw'} // Embed SVG icons
]
},
resolve: {
extensions: ['', '.js', '.jsx'],
unsafeCache: true
}
}
module.exports = config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment