geddski / csstyle

MOVED TO https://github.com/csstyle/csstyle a modern approach for crafting beautifully maintainable stylesheets
http://csstyle.io
Other
851 stars 34 forks source link

Warning for duplicate components feature? #52

Open 7ammer opened 9 years ago

7ammer commented 9 years ago

Hello, Any chance in implementing a feature to check for duplicate components. This would help us avoid overriding existing components.

Cheers

geddski commented 9 years ago

Not a bad idea. There is one use case though that relies on it allowing duplicates: extending components. We could make it an option, disabled by default.

7ammer commented 9 years ago

Just read comment #38. Interesting ideas!

I'd be happy with the option you suggest :)

My thoughts were to try and find a way to prevent accidentally braking encapsulation. An alternative method to ensure encapsulation could be to add an option to generate a random suffix id at the end of the component selector ie .selector-ID43F6 but then that makes things hard to use in other places for example selecting in javascript with querySelector(). It would also brake your method for extending again ;)