Skip to content

feat: add option to import css manually#116

Closed
mod08 wants to merge 1 commit intoxiaoluoboding:mainfrom
mod08:feat/manual-css-import
Closed

feat: add option to import css manually#116
mod08 wants to merge 1 commit intoxiaoluoboding:mainfrom
mod08:feat/manual-css-import

Conversation

@mod08
Copy link
Copy Markdown

@mod08 mod08 commented May 19, 2025

I needed a way to use vue-sonner inside a web component and therefore insert the css manually. I've updated the vite config to add the style.css to the build output and added a separate entry point which doesn't include the __insertCSSVueSonner function.

If someone wants to use the library without the css auto insert they can import from 'vue-sonner/manual'. import from 'vue-sonner' will still auto insert the css.

example

<!-- App.vue -->
<script>
import { toast, Toaster } from 'vue-sonner/manual'
</script>

<style>
@import 'vue-sonner/style.css'
</style>

@xiaoluoboding let me know if that's something you want to support. If yes I can also update the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vue-sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 19, 2025 9:24am

@xiaoluoboding
Copy link
Copy Markdown
Owner

hey @mod08 we are working on new version #115,

You might not have noticed, but we are releasing a new version that could conflict with the issue you're addressing or may have already resolved it. Please wait for the new version release, as this PR might be discarded.

@mod08
Copy link
Copy Markdown
Author

mod08 commented May 21, 2025

Thanks for you're response! I saw the PR but wasn't sure how long it will take to make version 2 happen. Since this PR doesn't introduce any breaking changes it could have been a version in between.

@xiaoluoboding
Copy link
Copy Markdown
Owner

We are now support import css manually, checkout the version v2.0.0

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.

vue-sonner doesn't work into Web Components Hope to split the CSS into separate files

2 participants