4 ms·
Ask HN: How many web developers *don’t* use a JavaScript framework?
I run a small site where I publish daily content. I use Express.js for the server-side logic, which works fine, but on the client side, I (until now) used jQuery with a set of (more or less unorganized) JS modules (bundled with Browserify).
I’m now moving to the Preact framework (very similar to React but only 3 KB), and my mind is blown by how much this new system improves code organization. Whereas before the source code of a page component (the HTML, CSS, JS parts) would be scattered around in different parts of my project’s directory structure and I would have trouble keeping track of which files exactly “belong together”, now it’s all neatly organized (e.g. each component in its own directory; logic + JSX template in one file, styles in another file).
Now, I’m not a “professional” web developer (my job is publishing content), but I can’t help but wonder, how many practicing web developers don’t use JS frameworks, and how do they keep their code organized? My old system didn’t work and I’m interested in hearing what I should have been doing.
- phortuin 10y agoOne of our (the front-end development company I work for) main principles of file management is to not use so called ‘sock drawers’, ie. folders with files all of the same kind (`/css` containing css, `/scripts` containing JS etc). Instead, we build up everything as components and put all belonging files in there. Example: modules/ └── header/ ├── header.html ├── header.demo.html ├── header.less ├── header.js └── README.md We don’t always use JS frameworks, because we are pretty adamant about progressive enhancement and JS frameworks have little love for PE. If we do use a framework, we still keep to the same file/folder structure (similar to your example; organising all component files in their own folder). Bottom line is: for me, JS frameworks and code/file organisation have nothing to do with each other. Even if you build a no-JS website, you would still build components, views, have build tasks, a server app etc. The only thing missing is a couple of client side JS files here and there— and that won’t be of influence to the organisation of a project’s files.