7
anekix
6y

To all the front-end engineers here I have a question. Say I am trying to create reusable CSS web components how do you create them? Shadow Dom?.
If not then how do you make sure the custom elements that you create can be resued in other projects?

Comments
  • 0
    OK I think I got am answer. Use component frameworks like angular vue or react , create my components within them in a kind of package and reuse them where ever required in the project
  • 0
    That would mean you would have to reuse the framework. A html snippet, js and css is enough. No need for any framework
  • 0
    Yeah but then to create web components we need to use some complicated and convulated shadow Dom APIs .
    For large scale projects using a framework can be of great help
  • 1
    google atomic design

    and have a look on this
    https://patternlab.io/
  • 1
    @norman70688 Yes I am sure.if I am wrong please correct me. Browsers provide shadow doms for component isolation. Polymer was a project which exposed it's own APIs for such things but projects like angular /react/vue made creating reusable components a breeze. More than a JavaScript library like jquery they are framework to created web UI's ( check react official description) but mostly people confuse them with some sort of enhanced Js framework that extend jquery or so library to a next level.
  • 0
    @norman70688 please tell me more senpai
  • 0
    @norman70688 haha thanks I was using reusable CSS term wrongly here when I meant web components
  • 1
    @anekix I got confused too o.O
Add Comment