Nes.css: Add prefix to class name

Created on 27 Nov 2018  ·  12Comments  ·  Source: nostalgic-css/NES.css

⚠️Breaking changes⚠️

Since NES.css doesn't provide layout. It maybe conflict when NES.css using the common class name.
Maybe add a prefix like ns- or nes- to solve this.

レイアウト関連のスタイルは提供していないためユーザ任せになる。そのときにNES.cssで汎用的なクラス名を使っているとコンフリクトする可能性がある。

ns-nes-みたいなprefixをつけてコンフリクトを解消したい 🤔

<!-- ユーザ定義(.container) -->
<section class="container">
    <!-- NES.css (.ns-container.with-title) -->
    <section class="ns-container with-title">
    </section>
</section>
breaking enhancement released

Most helpful comment

"ns-" would not be a good choice - it may be confused with "ms" when reading, whilst not paying attention. I suggest either "nes" or "ncss" or "8bit".

All 12 comments

Translation:

Title: Add prefix to class name

Body:

Since NES.css doesn't provide layout. It maybe conflict when NES.css using the common class name.
Maybe add a prefix like ns- or nes- to solve this.

@DanSnow Thanks for translate 🙇

"ns-" would not be a good choice - it may be confused with "ms" when reading, whilst not paying attention. I suggest either "nes" or "ncss" or "8bit".

.8bit-selector is an invalid selector, since CSS selectors can't start with a digit. .nes-selector would be a good one, though, as it's not used by any other major CSS libraries.

Derp, I forgot that for a moment... Then I am siding with nes-.

OK, nes- 👍

For example...

<button class="nes-button is-primary"></button>

<section class="nes-container is-rounded with-title"></section>

<i class="nes-icon heart is-large"></i>

<div class="nes-field">
  <input class="nes-input is-success">
</div>

Yes, I’d agree on that. :)

This issue include breaking changes. ⚠️
so I would like to fix after setting CI. -> #13

I'd suggest everything should have a prefix. is-large, is-primary etc could all be classes used in other libraries.

I think that there are few libraries that only use .is-primary or is-xxx. 🤔

For example, in the case of bulma.

.button
   &.is-primary

https://github.com/jgthms/bulma/blob/master/docs/_sass/index.sass#L72-L73

.nes-btn.is-primary(NES.css) and .button.is-primary(Bulma) do not conflict.
so, I think that prefix is not necessary for everything 🙈

Another option we could eventually look into is allowing users to generate their own version of the library. This idea comes from the Brototype library. There's a companion to that library, Bro-tie, that allows the user to do just that.

It's certainly not something we need to bother with while the framework is still in such an early stage, but it would certainly be a fun option to provide. Either way, I agree that we should be fine if we add the prefix to the main classes, then we leave the modifiers as they are.

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

panoramix360 picture panoramix360  ·  6Comments

Ding-Fan picture Ding-Fan  ·  5Comments

smonette picture smonette  ·  3Comments

maartenterpstra picture maartenterpstra  ·  4Comments

BcRikko picture BcRikko  ·  6Comments