DEV Community

Discussion on: How to make an e-commerce website with HTML, CSS and JS - 01

Collapse
 
arberbr profile image
Arber Braja • Edited

Cool stuff but some of the practices shown are not the best ones. Example you are using '@import' inside a CSS file. Which is not that good for performance. In simple HTML, CSS and JS site, its better if you have multiple CSS being request using the traditional link href method, especially if your host is http2 ready.

Also, HTML being handled in JS. That also is not the best separation of concerns. I know, in frameworks/libraries like React for example you write HTML (in React's case. JSX) inside JS but those apps are built like that, that the state builds the UI and you need to tie up really close the UI and components with the state for the app to work as expected.

On this scenario we dont have this kind of requirement.

Not saying it does not work. It works and it works well. Is it a good thing to mix technologies though like this? Probably not.

Just some personal opinions. Hope on the next articles in the series you will improve these suggestions.

Collapse
 
themodernweb profile image
Modern Web

Thanks for your comment. I'll surely follow your advice for better performance ☺️

Collapse
 
patrickagostini profile image
PatrickAgostini

Regarding the separation between js and html, I'm wondering how you would handle dynamical loading of products from, e.g., a CMS, and creating respective product cards without using some combination of js and html... Do you have any idea regarding this? In react it is straightforward, due to the mixing of html and js world.
Thanks in advance for any tip :)