Foren

CSS best Practices

thumbnail
Sarah Giles, geändert vor 12 Jahren.

CSS best Practices

Junior Member Beiträge: 61 Beitrittsdatum: 19.07.11 Neueste Beiträge
I am having a debate with a college and am looking for other opinions. On the best place to put the CSS.
We are specifically talking about CSS relating to Web Content Templates and structures.

One of us thinks the best place to put the CSS is in the the Web Content VM template in Style tags. That way the style is always with the web content and if you want to change it you don't have to go back and re deploy the theme or search for it in the theme. This will make them easier to edit and they will be independent of the theme.

The other thinks that all CSS should be in the theme and brought handled though the liferay header. (btw would the SASS work for Styles in VM templates?)
This way all styles stay together and can be managed and manipulated from one place. They can also more easily be stored out side of the liferay database and would have better version control.
thumbnail
David H Nebinger, geändert vor 12 Jahren.

RE: CSS best Practices

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Probably both are correct.

A theme is where you're going to put general styling rules so that the portal page as a whole has a similar look and feel to it (and yes, SASS is supported in the themes).

For web content, you may need to have specific styling overrides for that content, so putting it in there will isolate it from the general theme.

I'd probably approach it by deciding how often a style is going to be applied. If it is a style that is going to be applied in a lot of different places, put it in the theme. If it is only going to affect a handful of web contents, then leave it there.
thumbnail
Sarah Giles, geändert vor 12 Jahren.

RE: CSS best Practices

Junior Member Beiträge: 61 Beitrittsdatum: 19.07.11 Neueste Beiträge
But Sass will not parse in the web content. so you will not be able to use varriables or mixins
thumbnail
David H Nebinger, geändert vor 12 Jahren.

RE: CSS best Practices

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
I thought you were talking about the theme-based VM templates...