Skip to content

Instantly share code, notes, and snippets.

@bvanderlugt
Last active October 13, 2016 04:35
Show Gist options
  • Save bvanderlugt/a511a0e5c063a4e6f7f1bf7b6b7a9f2f to your computer and use it in GitHub Desktop.
Save bvanderlugt/a511a0e5c063a4e6f7f1bf7b6b7a9f2f to your computer and use it in GitHub Desktop.
# React webpack and sass
# depends on: npm babel webpack weback-dev-server -g
npm init
npm install react react-dom --save
npm install babel-loader babel-core babel-preset-es2015 babel-preset-react
# for a simple project make a directory structure like so
touch index.html App.js main.js webpack.config.js
## webpack.config.js using sass loader
```
module.exports = {
entry: './main.js',
output: {
path: './',
filename: 'index.js'
},
devServer: {
inline: true,
port: 3333
},
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}, {
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}]
}
}
```
# Add to start in package.json
```
"start": "webpack-dev-server"
```
## SASS(y) thangs
npm install --save-dev sass-loader css-loader style-loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment