2017-05-27 12:12:37 +00:00
|
|
|
const trash = require('trash')
|
|
|
|
|
2017-02-17 15:04:58 +00:00
|
|
|
module.exports = {
|
|
|
|
webpack: (config) => {
|
|
|
|
config.module.rules.push(
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'emit-file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'dist/[path][name].[ext]'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'skeleton-loader',
|
|
|
|
options: {
|
2017-05-27 12:12:37 +00:00
|
|
|
procedure: function (content) {
|
|
|
|
const fileName = `${this._module.userRequest}.json`
|
|
|
|
const classNames = JSON.stringify(require(fileName))
|
|
|
|
|
|
|
|
trash(fileName)
|
|
|
|
|
|
|
|
return ['module.exports = {',
|
|
|
|
`classNames: ${classNames},`,
|
|
|
|
`stylesheet: \`${content}\``,
|
2017-02-17 15:04:58 +00:00
|
|
|
'}'
|
|
|
|
].join('')
|
2017-05-27 12:12:37 +00:00
|
|
|
}
|
2017-02-17 15:04:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'postcss-loader'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
return config
|
|
|
|
}
|
|
|
|
}
|