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

feat: add css key to vite config #518

Merged
merged 9 commits into from
Feb 8, 2025

Conversation

jacobhq
Copy link
Member

@jacobhq jacobhq commented Feb 6, 2025

Checklist

Related issue

Fixes #504

Overview

Add CSS key to vite config.

@github-actions github-actions bot added the typescript Requires typescript knowledge label Feb 6, 2025
@jacobhq jacobhq marked this pull request as ready for review February 7, 2025 06:58
@Valerioageno
Copy link
Member

@jacobhq does this PR fix the bug you linked on your local setup?

@jacobhq
Copy link
Member Author

jacobhq commented Feb 7, 2025

@jacobhq does this PR fix the bug you linked on your local setup?

To use the solution:

import type { TuonoConfig } from "tuono/config";

const config: TuonoConfig = {
  vite: {
    css: {
      preprocessorOptions: {
        sass: {
          api: 'modern-compiler', // or "modern"
        },
      },
    },
  }
};

export default config;

We need to upgrade vite to at least 5.4. I think we should upgrade vite straight to v6, which will fix #504, and not require the user to make config changes.

This PR is still valid and useful, but it won't fix #504 unless we upgrade vite in this PR. How should I proceed?

@Valerioageno
Copy link
Member

Valerioageno commented Feb 7, 2025

Why do we need to update vite here?
I think we should just add the key in the normalizeConfig function.

The goal is to deliver quality on the first iteration (when the fix is small/medium size) for multiple reasons:

  1. We don't risk to release partial fixes
  2. We review only ready and meaningful PR without wasting time
  3. We keep a better tracking with the issue system

Please make this PR draft and ask for review when the whole bug fix is addressed. If you need help we can sync on Discord

@jacobhq jacobhq marked this pull request as draft February 7, 2025 12:39
@jacobhq
Copy link
Member Author

jacobhq commented Feb 7, 2025

Why do we need to update vite here?

Current version of vite in tuono does not support the api: 'modern-compiler', as per Sass docs, so the issue won't be fixed unless we take one of the paths I mentioned above. I suggested upgrading to vite 6 or above because it uses modern-compiler by default, and we will eventually need to do this upgrade anyway.

I think we should just add the key in the normalizeConfig function.

Sorry, I didn't realise we had this config build step. I will update it, which will add CSS config support, however even after this, the issue won't be fixed unless we upgrade vite.

Again, sorry about the early review.

@Valerioageno
Copy link
Member

I see two task to fix this issue:

  • update the normalizeConfig function + update the tests
  • Bump vite to "vite": "^5.4"

@jacobhq jacobhq marked this pull request as ready for review February 7, 2025 22:18
Copy link
Member

@marcalexiei marcalexiei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments.

I also performed a quick test on `examples/tuono-app` and it seems to be working

Screenshot 2025-02-08 at 01 41 45

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 8, 2025
Copy link
Member

@marcalexiei marcalexiei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time, could you please follow the contributing guidelines and procedures?

https://tuono.dev/documentation/contributing/pull-requests#overview

Please don't:
Do not use force push after marking the PR ready for review.
Reasoning: GitHub cannot track changes across force pushes, which slows down our ability to perform incremental reviews.


https://tuono.dev/documentation/contributing/pull-requests#addressing-review-feedback

After addressing all feedback, whether through code changes or by starting a follow-up discussion, please re-request a review from each maintainer whose feedback you've addressed.

Thanks


I left one comment regarding the documentation text for the option.

@jacobhq
Copy link
Member Author

jacobhq commented Feb 8, 2025

Yep, thanks. In future I will merge instead of rebase, so no more force pushes.

@jacobhq jacobhq requested a review from marcalexiei February 8, 2025 12:04
Copy link
Member

@marcalexiei marcalexiei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me.

@Valerioageno Valerioageno merged commit 0f72506 into tuono-labs:main Feb 8, 2025
18 checks passed
@jacobhq jacobhq deleted the jm-config-css-key branch February 8, 2025 15:16
@jacobhq jacobhq restored the jm-config-css-key branch February 22, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation typescript Requires typescript knowledge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: impossible to use the "css" key config (available in vitejs config) in the tuono.config.ts file
3 participants