Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible options for css preprocessors like less #332

Closed
AngusFu opened this issue Jun 3, 2020 · 1 comment
Closed

More flexible options for css preprocessors like less #332

AngusFu opened this issue Jun 3, 2020 · 1 comment

Comments

@AngusFu
Copy link
Contributor

AngusFu commented Jun 3, 2020

Is your feature request related to a problem? Please describe.
I want to set javascriptEnabled and modifyVars for less.

Describe the solution you'd like
I need a way to pass on my options.

From the screenshot below I can see that this is not possible at present.

image

Describe alternatives you've considered

May be we need to put some fields in vite.confg.js, like ——

module.exports = {
  plugins: ['react'],
  // ...
  cssPreprocessorOptions: {
    less: {
      javascriptEnabled: true,
      modifyVars: { ... }
    },
    // ....
  }
}

For now I'm just HACKing in vite.config.js ——

// HACK
Object.assign(require('less').options, {
  javascriptEnabled: true,
  modifyVars: { ... }
});

Additional context
None.

daychongyang added a commit to daychongyang/vite that referenced this issue Jun 3, 2020
daychongyang added a commit to daychongyang/vite that referenced this issue Jun 3, 2020
yyx990803 pushed a commit to daychongyang/vite that referenced this issue Jun 4, 2020
@samelie
Copy link
Contributor

samelie commented Oct 22, 2020

What you expected now works. I'm using ant-design and am overriding the defaults.

    less: {
      modifyVars: {
        white: '#333',
        'component-background': '#777',
        'primary-color': '#1DA57A',
        'link-color': '#1DA57A',
        'border-radius-base': '2px',
      },
      javascriptEnabled: true,
    },
  },

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants