question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Style changes remove all styles

See original GitHub issue

Full disclosure: I’m new to Svelte and Elder.js, so I might be missing something obvious.

I found an odd behavior when changing styles:

Whenever I change any style property in a .svelte file, the whole style declaration for the file disappears from the page. On save, both rollup and nodemon work as expected, and the page is reloaded. Anyhow, the styles for the component completely disappear. The only way to restore them is to stop and re-run rollup, refresh the page, and only then, the style changes are available.

I was able to reproduce the problem by creating a new project and changing only the .banner background color in the Home.svelte file.

Here are the steps:

  1. Run:
npx degit Elderjs/template elderjs-app
cd elderjs-app
npm install
npm run dev:rollup
npm run dev:server
  1. Open src/routes/home/Home.svelte and change line 16 to background: red;
  2. Save and observe styles disappear from Home

My hunch is that this has something to do with the scoped styles, as :global() declarations are unaffected, and undoing the changes restore the original styles.

If relevant:

macOS 11.0.1
node v15.5.0 (also tried with v12.18.0)
npm v7.3.0 (also tried v6.4.8)
rollup: 2.33.3
svelte: 3.29.0
elderjs: 1.2.1

In any case, really love the project! Thanks for open sourcing this, looking forward to using it for my website. 🙏

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
angelgarpicommented, Jan 4, 2021

I created an issue in template repository, probably related to this: https://github.com/Elderjs/template/issues/38

0reactions
nickreesecommented, Jan 29, 2021

@Agedjus @kiuKisas @stefan-contiero pushed a fix for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reset/remove CSS styles for element only - Stack Overflow
all :revert will RESET all the style properties on your element back to the original browser default UA style sheet property values, or...
Read more >
How to reset/remove CSS styles for element ? - GeeksforGeeks
But manual styles cannot be applied until the default styles are removed. Hence we apply the following code to remove the default styles...
Read more >
Add and remove styles from the Quick Styles gallery
On the Home tab, in the Styles group, right-click the style in the gallery that you want to change, and then select Modify....
Read more >
all - CSS-Tricks
The all property in CSS resets all of the selected element's properties, except the direction and unicode-bidi properties that control text ...
Read more >
Remove Styles from Text in Word - Instructions
The first way to remove style formatting is to select the text from which you want to remove the formatting. Then, click the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found