sveltejs / sapper

The next small thing in web development, powered by Svelte
https://sapper.svelte.dev
MIT License
7k stars 434 forks source link

error page global style accessible in all other pages too #1771

Open babakfp opened 3 years ago

babakfp commented 3 years ago

Describe the bug Check out this repo. There is 2 pages routes/index.svelte and routes/_error.svelte. Run the project and you will see the "HOME PAGE" title in red color. It's because I used a global style on the _error page that is affecting the home page elements too.

To Reproduce I did create a repo, visit https://github.com/babakfp/sapper-layouts-and-error-page-issue There are just 2 files (routes/index.svelte and routes/_error.svelte) to worry about.

Expected behavior I expect that the _error.svelte page acts like a real page. It isn't a real page. It's just a component.

Information about your Sapper Installation: I copied from this repo sveltejs/sapper-template

Severity In my project, I have a dynamic class and some styles for that classes. Svelte detect and removed them as unused CSS🤨😂. Also as I said, an error page must act like a page, not a component. Right now I don't know how to solve this problem and I can't ask the community because one of the admins removed me from the Discord server (for no reason 😊). It is a real project and I have a real problem please help😂.

some related issues https://github.com/sveltejs/svelte/issues/697 https://github.com/sveltejs/svelte/issues/1594

Additional context This is the component file that I have an issue with CubeHover.zip I'm trying to recreate this in Svelte: https://codepen.io/babakfp/pen/PrZLdY