title: Web Components et développement

> By moving to a component model, we should strive to have our components be completely self-contained and, ideally, made up of a single file. But thinking in terms of components might actually make our project end up with a larger number of files than a project which did not. The goal is to make it such that those files are not implicitly coupled with one another, and implementing a change in one will not usually necessitate updating a chain of other files.
>
> By moving in data retrieval and styling into the component itself, we actually start to shed a lot of the weight off of the other parts of the app that were a little bit heavier before. The need for the "M" and the "C" in "MVC" might go away entirely...
>
> <cite>*[One Concern, One File](http://tech.pro/blog/6968/one-concern-one-file)* ([cache](/david/cache/5f89f7653ed5ada2aee9ad649b984141/))</cite>

J’aime beaucoup les [approches actuelles](https://medium.com/seek-ui-engineering/the-end-of-global-css-90d2a4a06284) ([cache](/david/cache/95e919fd9da95be15758b7cd420b6d0c/)) qui tendent à regrouper les fragments de code relatifs à un même composant visuel. L’ajout d’un périmètre permet d’[imbriquer les composants](http://simurai.com/blog/2015/05/11/nesting-components/) ([cache](/david/cache/cf86bb38cba70b66e0d7badbdae4ee09/)) de [manière plus saine](http://philipwalton.com/articles/extending-styles/) ([cache](/david/cache/2f185d06dc6c4f9dff67e11d93cbb7a7/)). En attendant de pouvoir utiliser le *scope* des `CSS` [de manière native](https://developer.mozilla.org/en-US/docs/Web/CSS/:scope), je vais me contenter d’utiliser [RiotJS](https://muut.com/riotjs/) qui [les supporte](https://muut.com/riotjs/guide/#scoped-css).

J’espère qu’à terme les navigateurs permettront d’afficher la source des composants web de manière lisible et exploratoire pour un nouveau-venu dans le développement web. C’est un point stratégique critique pour la compréhension du web par le plus grand nombre.