Johann-S / bs-customizer

Create a custom Bootstrap 4.x build
https://johann-s.github.io/bs-customizer/
MIT License
17 stars 2 forks source link

Add js prefix to all elements where javascript is applied to. #40

Closed MartijnCuppens closed 5 years ago

MartijnCuppens commented 5 years ago

In my own projects I always add a js- prefix to classes of element where javascript is applied to. By using js- prefix for classes in DOM elements you decouple functional aspects of these elements from CSS ones. An example:

<a class="btn js-popup">Click me!</a>

This has some advantages:

(source: https://coderwall.com/p/qktuzw/decouple-javascript-classes-from-css-ones-by-using-prefix, this just perfectly described what I meant)

What do you think @Johann-S, @XhmikosR?

XhmikosR commented 5 years ago

While this might be a good idea for advanced usages, the classes here should be exactly what they are upstream, at least by default.

On Sat, Sep 29, 2018, 11:13 Martijn Cuppens notifications@github.com wrote:

In my own projects I always add a js- prefix to classes of element where javascript is applied to. By using js- prefix for classes in DOM elements you decouple functional aspects of these elements from CSS ones. An example:

Click me!

This has some advantages:

  • as css coder, you can easily change anchor design by changing btn class and not worry it'll break pop up behavior.
  • and conversely, as JavaScript developer you can remove popup behavior and never break any existing CSS rules.

(source: https://coderwall.com/p/qktuzw/decouple-javascript-classes-from-css-ones-by-using-prefix, this just perfectly described what I meant)

What do you thing @Johann-S https://github.com/Johann-S, @XhmikosR https://github.com/XhmikosR?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Johann-S/bs-customizer/issues/40, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVVtTbrLF5so9i5kGso549Lpf07B66eks5ufyuagaJpZM4XAZSs .

MartijnCuppens commented 5 years ago

the classes here should be exactly what they are upstream, at least by default.

Can you clarify this a bit more?

Johann-S commented 5 years ago

It seems a good idea to me 👍

XhmikosR commented 5 years ago

Wait, you mean add the ability to specify an optional prefix?

Or you meant this for the customizer's own code?

MartijnCuppens commented 5 years ago

@XhmikosR, the customizer's code, didn't realise this wasn't clear untill I read your comment 😀

XhmikosR commented 5 years ago

Ah, OK then :)

MartijnCuppens commented 5 years ago

Haha, the good first issue tag, thanks @Johann-S! I'll have a look at this 🙂