7 ms·
About optional JS: you can have that with server-side rendering plus a modern framework (like next.js or leptos). That's certainly not as simple as vanilla html
by nextaccountic 3y ago
About optional JS: you can have that with server-side rendering plus a modern framework (like next.js or leptos). That's certainly not as simple as vanilla html and js, but totally doable.
- tipiirai 3y agoYou sure can, but it then comes to the separation of concerns. CSS-in-JS (coupling of concerns) is the preferred option.
- teaearlgraycold 3y agoHaving CSS in a separate file feels like defining the predicates for your if statements in a separate file. With tailwind we're getting pretty close to a great solution here.
- shadowbanned4 3y ago[dead]
- kkarpkkarp 3y ago> you can have that with server-side rendering plus yes, we use PHP for this which is much simpler to grasp than JS-SSR
- geek_at 3y agoplus you don't need to restart any services or rebuild servers. Just git pull and you have the new code on the live server without even a second of downtime
- flemhans 3y agowatch -n 1 git pull
- wouldbecouldbe 3y agoNah, not simpler, nextjs is simpler then php to start working with. Also running & deploying nowadays is easier. PHP used to be easiest, but fell behind.
- deleted 3y ago[deleted]
- pzmarzly 3y agoThis very much depends on what you are building and how experienced you are. If you just want a few pages, no need for background workers or database migrations, PHP is still the king. You download one of many single-executable LAMP servers, and start writing your index.php. Deploy? Just copy files to server. Zero downtime deploy? Copy files to server and use symlink to atomically switch versions. Dependencies? Composer (package manager) is a single-file script, you can place it wherever. Pain only begins when you want to break away from file-based routing, or need custom .htaccess and nginx.conf, or want to isolate components, or need Redis and cron for background jobs. On NextJS side, I knew a few people who wanted to start their career with it and the experience wasn't smooth. You install nodejs... but your distribution only ships Node 12, so everything is failing with cryptic errors. You search how to upgrade Node, and get caught in nvm vs n vs asdf flamewars. Once you found a working solution (which probably required you to edit env variables), you run the npm command... and it wants root access? To install packages system-wide? So you google around, find a way to make it use the user home directory. Then you are up and running, you aren't sure what this "React" thing is, but you get stuff done. Time to deploy - and you are told to either learn Docker (and Kubernetes if you want zero downtime), or to use one of few hosting companies with a price markup. Well, at least there is a free tier (for now), so most people choose the latter. Was this a simple start? Now, when it comes to big apps, I'd very much rather use Nextjs than PHP, it is production-tested, gives you a lot "for free", JS LSP is built-in to VSCode, I already know React and most of JS ecosystem. But if somebody tells me that they just finished learning HTML and vanilla JS, and they want to do something simple server-side, I'm torn on what to recommend nowadays.
- wouldbecouldbe 3y ago
- vmfunction 3y agoIn node there is EJS which is basically PHP templating with JS.
- postepowanieadm 3y agoEven better - you may use service workers as your 'server-side'.