4 ms·
I'm taking the "no build step" thing to the extreme in one of my projects. PHP has libraries for compiling SCSS and minifying JS, and filemtime() is very fast.
by kijin 3y ago
I'm taking the "no build step" thing to the extreme in one of my projects.
PHP has libraries for compiling SCSS and minifying JS, and filemtime() is very fast. So if you wire them together in just the right way, you can edit any script or stylesheet under the project hierarchy and have them compiled, minified, and bundled together on the fly. Cache the bundle until you edit one of them files again, and automatically bust the cache once you do.
No need to build anything whatsoever, both on the frontend and on the backend. It's like REPL over HTTP.
- todotask 3y ago> PHP has libraries for compiling SCSS and minifying JS, and filemtime() is very fast If you do compiling and minifying, that's a build step.
- wildrhythms 3y agoThe usage of the term 'step' here is in the pre-deployment development process sense. I think what this person is doing is converting SCSS to CSS on request, at runtime.
- todotask 3y agoRegardless of which steo, compilation process is typically done as part of a build step, where the SCSS files are transformed into the final CSS that will be served as a bundle to the end users' application. Web browsers can't understand SCSS natively. To be truly extreme (performance), devs should consider tree-shaking unused CSS and JavaScript. This may require using Vite (Rolldown is in the works/Rollup) if there are no other options or it makes no sense to serve bloated resources. That's the reason, I chose Astro as I care about users, not prioritse the developers' minimalistic workflows. I prefer Tailwind because it allows me to avoid duplicating classes (mine and vendors), which is an advantage over other approaches. I did dogfooding in Go development.
- kijin 3y agoEvery human-readable programming language must be compiled into some sort of bytecode (opcode in PHP) and/or machine language in order to work. The question is whether a human ever needs to be aware of that step. In PHP, you generally don't. In the aforementioned setup, you don't need to be aware of SCSS compilation and minification, either. Not even if you use devtools, because the map file will point to the correct line in the original source.
- hu3 3y agoI can confirm, this approach works great! I use this in production for a system with 3k requests per second that runs in a single Apache+PHP web server and a single 80GB MySQL database. Never needed to optimize anything. You have no idea how happy it makes me to see someone else was bold enough to try this and it worked for them too. Simple, maintainable, instant SCSS and JS build pipelines with all the benefits and no drawbacks! Plus any junior can understand and change it in minutes.