SolidZORO / next-plugin-antd-less

🎩 Use Antd (Less) with Next.js v12, Zero Dependency on other Next-Plugins.
MIT License
345 stars 48 forks source link

Plugin not working on windows (works fine on linux) #86

Closed yxx4c closed 2 years ago

yxx4c commented 2 years ago

The plugin works fine on linux but fails to work on windows. There are no errors what so ever, but the changes made in variables.less are not reflected when in windows env.

Sample code: https://github.com/yxx4c/-next-plugin-antd-less-issue-86

SolidZORO commented 2 years ago

@yxx4c sorry, i not have a windows PC. Is it solved?

yxx4c commented 2 years ago

@SolidZORO It's not resolved yet, I'm using some alternative methods to do it manually after every change and generate a static css file. If you could look into it, it would be a huge help, I can provide as much information as you need. Thank you for the awesome project and the time you took to respond to the issue 😊

SolidZORO commented 2 years ago

It seems to be a windows problem, you can go to the nextjs issues to ask.

sgillespie commented 2 years ago

This is working for me on Windows, but my setup is a little different:


const withAntdLess = require('next-plugin-antd-less');
const lessToJS = require('less-vars-to-js');

// Where your antd-custom.less file lives
const themeVariables = lessToJS(
  fs.readFileSync(path.resolve(__dirname, './src/styles/antd-custom.less'), 'utf8')
);

module.exports = withAntdLess({
  // <-- Snip -->
  lessLoaderOptions: {
    lessOptions: {
      javascriptEnabled: true,
      modifyVars: themeVariables // make our antd custom effective
    },
// <-- Snip -->
});