2017-07-01 22:36:36 +00:00
|
|
|
const fs = require('fs')
|
2017-05-27 12:12:37 +00:00
|
|
|
const trash = require('trash')
|
|
|
|
|
2017-02-17 15:04:58 +00:00
|
|
|
module.exports = {
|
|
|
|
webpack: (config) => {
|
2017-07-01 22:36:36 +00:00
|
|
|
config.plugins = config.plugins.filter(
|
|
|
|
(plugin) => (plugin.constructor.name !== 'UglifyJsPlugin')
|
|
|
|
)
|
|
|
|
|
2017-02-17 15:04:58 +00:00
|
|
|
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`
|
2017-07-01 22:36:36 +00:00
|
|
|
const classNames = fs.readFileSync(fileName, 'utf8')
|
2017-05-27 12:12:37 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|