2017-03-02 16:37:58 +00:00
|
|
|
const path = require('path')
|
|
|
|
const glob = require('glob')
|
|
|
|
|
2017-02-11 23:22:35 +00:00
|
|
|
module.exports = {
|
|
|
|
webpack: (config, { dev }) => {
|
|
|
|
config.module.rules.push(
|
|
|
|
{
|
|
|
|
test: /\.(css|scss)/,
|
|
|
|
loader: 'emit-file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'dist/[path][name].[ext]'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2017-03-05 15:48:37 +00:00
|
|
|
use: ['babel-loader', 'raw-loader', 'postcss-loader']
|
2017-02-11 23:22:35 +00:00
|
|
|
}
|
|
|
|
,
|
|
|
|
{
|
2017-03-02 16:37:58 +00:00
|
|
|
test: /\.s(a|c)ss$/,
|
2017-03-05 15:48:37 +00:00
|
|
|
use: ['babel-loader', 'raw-loader', 'postcss-loader',
|
2017-03-02 16:37:58 +00:00
|
|
|
{ loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
includePaths: ['styles', 'node_modules']
|
|
|
|
.map((d) => path.join(__dirname, d))
|
|
|
|
.map((g) => glob.sync(g))
|
|
|
|
.reduce((a, c) => a.concat(c), [])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2017-02-11 23:22:35 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
return config
|
|
|
|
}
|
|
|
|
}
|