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

broken style since 1.2.0 #89

Open
ricardo17coelho opened this issue Oct 10, 2024 · 7 comments
Open

broken style since 1.2.0 #89

ricardo17coelho opened this issue Oct 10, 2024 · 7 comments

Comments

@ricardo17coelho
Copy link

v.1.5.0
Screenshot 2024-10-10 at 22 18 04

v.1.2.1
Screenshot 2024-10-10 at 22 18 53

@benjivm
Copy link

benjivm commented Oct 11, 2024

#88

@sadeghbarati
Copy link
Contributor

Hi, can you guys provide a Stackblitz or Codesandbox playground?

@ricardo17coelho
Copy link
Author

ricardo17coelho commented Oct 15, 2024

I use vue-sonnar in a vue, vuetify 3 app.

Looks like the problem is the paddingthat is not applied properly because vuetify has this css:

* {
    padding: 0;
    margin: 0;
} 

this avoids the vue-sonnar padding to be applied:

padding: 16px;

=> https://github.com/xiaoluoboding/vue-sonner/blob/main/packages/styles.css#L92

But this is strange. I have only 1 project with this issue. All others are OK.
I need to invesigate deeper..

@jstarfruits
Copy link

@sadeghbarati I believe this issue may be related to the Vite environment. The CSS generated by vue-sonner is placed before the CSS generated by Vite, causing the site's CSS to overwrite the padding styles. Increasing the specificity by using !important or nesting the class selectors should help stabilize the behavior.

@ricardo17coelho
Copy link
Author

Funny. In Production is fine.
But in DEV mode looks like the screenshot.
Maybe @jstarfruits has right

@jstarfruits
Copy link

@sadeghbarati
I have created a repository to reproduce the issue mentioned in #89. The reproduction code is available at test_vue_sonner.

Steps to reproduce:

  1. Clone the repository:

    git clone https://github.com/jstarfruits/test_vue_sonner.git
    cd test_vue_sonner
  2. Install dependencies:

    composer install
    yarn install
  3. Run the development servers in separate terminals:

    • Laravel server:
      php artisan serve --port=8888
    • Vite development server:
      yarn run dev
  4. Access the application at http://localhost:8888 to view the issue.

@sadeghbarati
Copy link
Contributor

The problem is because of inline-css feature we added in vite.config

In order to make it work in Nuxt project without using Nuxt transpile option in nuxt.config we inject CSS in the head tag

Which may cause problems in dev mode for some of the projects,

We need time to investigate to see if it's possible to bundle vue files without transpile them into js/cjs

nuxt/nuxt#15321 (comment)

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

No branches or pull requests

4 participants