Replies: 1 comment 1 reply
-
Saving everything inline with style attribute on the element will always overwrite any existing style as it has higher priority. node.style['font-size'] = '12px';
console.log(node.style['font-size']); VvvebJs saves all properties as css in a style tag
It uses https://github.com/givanz/VvvebJs/blob/master/libs/builder/builder.js#L2441
this.styles[media][selector][css_property][property_value];
this.styles["mobile"]["div#element"]["font-size"] = "12px"; On page load it parses the css from https://github.com/givanz/VvvebJs/blob/master/libs/builder/builder.js#L2471-L2475 On property change it generates the css with proper https://github.com/givanz/VvvebJs/blob/master/libs/builder/builder.js#L2579 and saves it back to |
Beta Was this translation helpful? Give feedback.
-
I am currently developing a CMS portal, the use case is very similiar to what vvveb does, i am stuck at a scenario, for example i am able to update the styles of a particular div, and I need to generate a different styles for the same div for mobile screen, i am following the same pattern of generating css selector hierarchy to set the style to an element as vvveb, but i am not able to retrive the existing style of the element and when i update it the existing other properites get overriden, for example 1st i set the font-size: 12px and next time i set the color: blue, the color is set but the font-size is gone, what do you think would be the right approach to acheive this, this is very properly done in vvveb, but i am unable to get how is it happening.
Beta Was this translation helpful? Give feedback.
All reactions