benfrain / ecss

Home for questions and answers relating to the implementation of the ECSS methodology
http://ecss.io
10 stars 0 forks source link

Site-wide 'things' #6

Closed zzcgulm closed 8 years ago

zzcgulm commented 8 years ago

Hi Ben,

Firstly thanks for inventing ECSS.

Secondly, following on from Site Wide micro-namespaces #5 (https://github.com/benfrain/ecss/issues/5), I have a question about how Alert boxes fit in ECSS methodology.

So, in ECSS, what should I do with:

Should they live in:

  1. a site-wide directory/file, with .sw namespace
  2. their own Module?
  3. or each instantation of the Notice box should be it's own ECSS Module

Thanks, Leigh

benfrain commented 8 years ago

Hi Leigh,

After considering this briefly my initial reaction would be to opt for a module for each box type and all the contextual variants contained in there. So individual modules like: BoxWarning, BoxInfo, BoxDanger and BoxSuccess, each with its own CSS file (e.g. BoxWarning.css, BoxInfo.css, BoxDanger.css and BoxSuccess.css).

Then namespace the classes to their context. So the variants for the warning boxes would all live in the BoxWarning module/css files:

.sw-BoxWarning {

}

If it was a site wide warning box. Or:

.doc-BoxWarning {

}

If it was a warning box in a document.

But, ECSS is intentionally loose enough to let you organise things a different way if you would rather, or you find it is more suitable.

zzcgulm commented 8 years ago

Thanks for the quick reply Ben, I have been implementing your comments. The results are:

benfrain commented 8 years ago

Looks good to me 👍

zzcgulm commented 8 years ago

It's working well. The only downside I can find is using a .sw namespace = a loss of one layer of hierarchy in class name, ie an inability to describe the relationship between classes with same depth, as there are only 2 layers to play with instead of 3:

benfrain commented 8 years ago

Hi @zzcgulm are you happy you have all the info you need? If so, I'll close this one down. Otherwise, feel free to ask any further questions. :)

zzcgulm commented 8 years ago

Yup, sure am. Thanks.