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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Vite / Vue 2.7 #98

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

davestewart
Copy link

@davestewart davestewart commented May 7, 2024

Hey @rogden,

I started this before noticing #91 but luckily I had already decided to limit the upgrade to Vue 2.x so as to not mess with existing dependencies.

So this PR will give you Vite 馃敟, but not force any Vue 3 upgrade 馃憖.

And when you want to upgrade to Vue 3, it should only be a couple of changes (see below)

Status

I have the main build running great with Vite, which can check out and run right now.

However, I noticed that the CLI export script is not happy with the mix of ES6 and CJS, so that will need some tweaking; either upgrading that module to ES6 / imports, or downgrading the tailwind.config.js file to CJS.

I'm not hugely experienced with tailwind (hence #97) and whether there are user constraints that would require config to remain at CJS, perhaps you can advise? I'm sure there is a way for Vite to import a CJS file, so I'm happy to investigate.

Also, seeing as #91 was ultimately rejected, are you happy for this PR to continue?

Future upgrade to Vue 3

Change:

  • @vitejs/plugin-vue2 to @vitejs/plugin-vue
  • vue version to ^3.0.0

@rogden
Copy link
Owner

rogden commented May 7, 2024

@davestewart Thanks for this! I'll look over it this week but I'm definitely interested in the PR/update path to Vite and eventually Vue 3.

This PR is appealing because it is incremental. The other PR had some elements I was interested in but I never got around to taking the bits I needed.

One thing to note (perhaps obvious) is that the Koa server is what ultimately serves the compiled app (and parses the Tailwind config to server to the compiled app at the /config.json endpoint) when someone uses the package.

Only when developing locally does the Vue CLI (and Vite in this case) run to serve the UI of the app. The other PR removed Koa in favor of using Vite to serve the production app which I wasn't keen on doing.

@davestewart
Copy link
Author

davestewart commented May 7, 2024

Yeah, and I think the confusion with what was serving the config file may have had something to do with my earlier ticket.

I think that can be solved with a little docs update though.

By the way, the window global for the config path; is that supposed to be in some way configurable at runtime?

I didn't see it get rewritten from anywhere.

@rogden
Copy link
Owner

rogden commented May 7, 2024

It is replaced when the export CLI command is executed here: https://github.com/rogden/tailwind-config-viewer/blob/master/cli/export.js#L20

It takes creates a hash of the config file contents and uses that as the file name instead of config.json to get around caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants