Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Froot75547y@AlexDeLarge I actually just use Babel for node code. You don't need much when writing for node and Babel is enough I feel. All it does is transpiled ES6 imports/exports and remove flow types (while still keeping them in a separate file)
But for frontend, Webpack for sure -
Froot75547y(ran out of edit time)
As for using Babel with dynamic js files. That's some next level voodoo man. Also, it won't scale.
I use a dynamic js file in one of my projects (it's gets some parameters injected into it from the request) but I try to keep it as minimalistic as possible. Also, I don't transpile it since nothing in that project is transpiled đ, so I can't help you here.
To be honest I can see that being a ESLint/flow horror story if you tried to use those on a dynamic js file. They'd have no idea what to do since part of the file is in a templating language and makes 0 sense as javascript -
Wombat105827y@AlexDeLarge I bundle them in modular files for one reason. I tried to keep the output small for each page and so there were scripts I use only on one particular page and some I use on every page, like the script for the pages navigation. If that's a bad way to do this, I am all ears.
-
Wombat105827y@AlexDeLarge @Froot also I glanced at Webpack and find out that it's pretty cool for development, because of his modular setting. Though I find it anoying tho explicitly define all files start end endpoint...
I bought Prepros a while ago to work with Sass fluently. And it offers me also some preprocessing features for JavaScript, like Babel and Uglyfying. Do you also know Prepros? Can I achieve the same workflow with it alike Webpack? -
Wombat105827yAfter learning more about Webpack there's a new question I have. How do I handle PHP in Webpack? I'm used to have controllers which load a view containing html, but all tutorials used Webpack to work with plain html files...
-
Froot75547y@Divisionbyzero Just take PHP out of the equation and it'll all be much much easier đ
-
Froot75547y@Divisionbyzero Don't. PHP is like meth. It feels good at first but in reality it's just dragging you down đ
(I had nothing useful to add to the conversation so I just rag on PHP like I always do đ) -
Wombat105827y@Froot okay đ As a good methhead I will tell you I never again will use PHP. But you will know that I lied. đ
-
Most would normally use php to serve the backend information in the form of json for their js frontends to consume and interact with it.
So basically, you would create your js frontend and test the urls, transpile everything to (for example) an index.html with the correct scripr src connection and voila.
Related Rants
I want to use Babel or Typescript for the first time. Because as I read it is the way to go, when compressing JavaScript and make it browser compatible. If that's false, please correct me.
There's a question I've got about this. Right now I am using a PHP router file dealing with requests and selecting the right .js file and compresses it. So I can write like modular JavaScript functions and include them when needed.
My question is, what do I have to change in my setup to switch to the mentioned technologies?
question
php
babel
javascript
typescript