Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 7f8214b

Browse files
committed
Add scss support
- Added https://github.com/jtangelder/sass-loader - Sample sass files to demonstrate how to work with multiple sass files
1 parent 8c02310 commit 7f8214b

File tree

5 files changed

+26
-5
lines changed

5 files changed

+26
-5
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@
3131
"babel-preset-es2015": "6.9.0",
3232
"babel-preset-react": "6.11.1",
3333
"babel-preset-stage-0": "6.5.0",
34+
"css-loader": "0.23.1",
3435
"eslint": "2.7.0",
3536
"eslint-plugin-react": "5.2.2",
37+
"node-sass": "3.8.0",
38+
"sass-loader": "4.0.0",
39+
"style-loader": "0.13.1",
3640
"webpack": "1.13.1",
3741
"webpack-dev-server": "1.14.1"
3842
},

src/index.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Application entrypoint.
2+
3+
// Load up the application styles
4+
require("../styles/application.scss");
5+
6+
// Render the top-level React component
17
import React from 'react';
28
import ReactDOM from 'react-dom';
39
import App from './App.jsx';

styles/application.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// This is the top-level scss file. Import all other files in here.
2+
@import 'home';

styles/home.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1 {
2+
color: tomato;
3+
}

webpack.config.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ module.exports = {
1313
publicPath: '/build/'
1414
},
1515
module: {
16-
loaders: [{
17-
test: /\.jsx?$/,
18-
loaders: ['babel'],
19-
include: path.join(__dirname, 'src')
20-
}]
16+
loaders: [
17+
{
18+
test: /\.jsx?$/,
19+
loaders: ['babel'],
20+
include: path.join(__dirname, 'src')
21+
},
22+
{
23+
test: /\.scss$/,
24+
loaders: ["style", "css", "sass"]
25+
}
26+
]
2127
}
2228
}

0 commit comments

Comments
 (0)