mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
77d5f36eea
Hey @timneutkens I've updated this example a bit. - Fixed `/asserts` spelling to `/assets`. - Removed the `/assets/styles.less` as importing this caused the entire ant-design css sheet to be loaded, now only the React components imported will have their styles loaded via the babel plugin which was already configured. Resulted in dropping the CSS for this example from ~630kb to ~220kb. - Removed `index.js` as it's not needed.
27 lines
636 B
JavaScript
27 lines
636 B
JavaScript
/* eslint-disable */
|
|
const withLess = require('@zeit/next-less')
|
|
const lessToJS = require('less-vars-to-js')
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
// Where your antd-custom.less file lives
|
|
const themeVariables = lessToJS(
|
|
fs.readFileSync(
|
|
path.resolve(__dirname, './assets/antd-custom.less'),
|
|
'utf8'
|
|
)
|
|
)
|
|
|
|
// fix: prevents error when .less files are required by node
|
|
if (typeof require !== 'undefined') {
|
|
require.extensions['.less'] = (file) => {}
|
|
}
|
|
|
|
module.exports = withLess({
|
|
lessLoaderOptions: {
|
|
javascriptEnabled: true,
|
|
modifyVars: themeVariables // make your antd custom effective
|
|
},
|
|
|
|
})
|