mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
0d0ab77db7
Fixes #1191
40 lines
902 B
JavaScript
40 lines
902 B
JavaScript
const trash = require('trash')
|
|
|
|
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: {
|
|
procedure: function (content) {
|
|
const fileName = `${this._module.userRequest}.json`
|
|
const classNames = JSON.stringify(require(fileName))
|
|
|
|
trash(fileName)
|
|
|
|
return ['module.exports = {',
|
|
`classNames: ${classNames},`,
|
|
`stylesheet: \`${content}\``,
|
|
'}'
|
|
].join('')
|
|
}
|
|
}
|
|
},
|
|
'postcss-loader'
|
|
]
|
|
}
|
|
)
|
|
|
|
return config
|
|
}
|
|
}
|