Skip to content

Commit

Permalink
add support for sass :)
Browse files Browse the repository at this point in the history
  • Loading branch information
davibe committed Jan 31, 2017
1 parent 5df6f2a commit 3b90234
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
10 changes: 7 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ module.exports = {
webpack: (config, { dev }) => {
config.module.rules.push(
{
test: /\.css/,
test: /\.(css|scss)/,
loader: "emit-file-loader",
options: {
name: 'dist/[path][name].[ext]'
}
}
,
{
test: /\.css/,
test: /\.css$/,
loader: "babel-loader!raw-loader"
}
,
{
test: /\.scss$/,
loader: "babel-loader!raw-loader!sass-loader"
}
)
// console.log(config.module.rules)
return config
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"dependencies": {
"babel-plugin-wrap-in-js": "^1.1.0",
"next": "^2.0.0-beta.18",
"raw-loader": "^0.5.1"
"node-sass": "^4.4.0",
"raw-loader": "^0.5.1",
"sass-loader": "^4.1.1"
},
"devDependencies": {
"now": "^3.1.0"
Expand Down
4 changes: 3 additions & 1 deletion pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react'
import fetch from 'isomorphic-fetch'

import style from './style.css'
import style from './style.scss'
// or, if you work with plain css
// import style from './style.css'

export default () =>
<div>
Expand Down
6 changes: 6 additions & 0 deletions pages/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$primary-color: black;

p {
font-size: xx-large;
color: $primary-color;
}

0 comments on commit 3b90234

Please sign in to comment.