Issue #1072Opened April 25, 2018by andsnake0 reactions

Cannot add a new css rule if an element that is using it is not present in the html

Question

HI, i'm using the latest build and i have the issue as described in the title.

I am editing html and css separately. I have noticed that when editing the css, if i try to add a new class, not used by any of the elements in the canvas yet, after saving, that css class is removed,

if instead i go and create a dummy div, assign i.e class ="test", and then go and add the .test{color="red"} rule to the css, the css change is retained correctly.

here is a JS Fiddle you can play with to see the behaviour. https://jsfiddle.net/d64sc5g4/

is this normal behaviour or a bug?

Answers (2)

artfApril 29, 20180 reactions

Yes, it's a normal behavior, the editor optimizes the exported code, but in the next release you'll find a new keepUnusedStyles option, which allows you to skip this optimization

lock[bot]September 17, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.