33
Views
11
Comments
Solved
importing css theme
Question

I have two webblocks importing a css theme from another module like this:

@import url('/Consumed/Theme.Consumed.css')

These webblocks are inside a webscreen.

When opening chrome developer tools it seems that classes are called twice.

How can I fix this? What is the best practice?

mvp_badge
MVP
Rank: #10
Solution

Hi Filipe,

As a best practice the (web)blocks should adapt to the themes in which they are added to (hence, the css of the (web)blocks are the first one's in the page. 

IMO, you should should avoid importing (platform themes) manually, and instead use the mechanisms of the platform.

I'm not sure if this answers to your question, but feel free to ask additional questions!

cheers,
RG

"IMO, you should should avoid importing (platform themes) manually, and instead use the mechanisms of the platform. "


The platform doesn't allow to import multiple themes, just descendant.

mvp_badge
MVP
Rank: #10

Can you please clarify what are you trying to achieve?

I don't want to see the same class definition twice.

mvp_badge
MVP
Rank: #10

Filipe, this is not what you're trying to achieve, but the consequence/side effect of that.

In order for anyone to help you (e.g. me, community, OS R&D?), please explain what are you trying to achieve (as a whole) - the scenario that lead to this "finding".

BTW, regarding how browsers work: the classes don't get classes duplicated - the browser computes them into the CSSOM

Ruben i think you are not understanding my issue. If you want you can replicate by doing the steps I described above.

mvp_badge
MVP
Rank: #59

Hello Filipe. 

Right now it seems that the issue is understanding what your issue is - pun intended. My suggestion, in order to speed up any help that anyone might be able to give you, would be to having you either showcasing, through screenshots, what you're facing (and your reasoning for the issue) or, better yet, to create a simple PoC in a module (or app) that showcases what you are trying to achieve - and that replicates your issue.

Cheers!

Sincerely I don't know why is it too difficul to understand. The issue was solved before your replies, anyway here it is a video describing the issue.

I fix the issue importing the theme into the main module and set the flow to that theme.

mvp_badge
MVP
Rank: #17

If you solved the issue yourself before someone even replied, be so kind to post the solution too, so others know they don't need to help anymore. Most people on the forum volunteer to help next to a busy day job. 


Did you my entire post ?

mvp_badge
MVP
Rank: #10


There's no video in your post... most likely removed by the forum mechanism... hence the answer from Daniël.