Does this mean that for each request, a JS file is generated? Or is it pre-generated with Webpack?
I don't seem to get it completely.
You will have an app.min.js file that was generated by Webpack and contains all your JS code.
But the idea of this guide is to have some kind of rule in our JS code that is similar to this:
if (myCurrentPage == "/contact") { // execute this piece code... } if (myCurrentPage == "/about-us") { // execute this other piece of code... }
So we'll not execute code that is not necessary for some pages...
There's also a great library that I use sometimes and do almost the same thing: github.com/lucasmazza/page.js
Oh okay ! I thought the idea was to create a JS file for each page. Makes sense now !
Thanks Ricardo !
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Does this mean that for each request, a JS file is generated? Or is it pre-generated with Webpack?
I don't seem to get it completely.
You will have an app.min.js file that was generated by Webpack and contains all your JS code.
But the idea of this guide is to have some kind of rule in our JS code that is similar to this:
So we'll not execute code that is not necessary for some pages...
There's also a great library that I use sometimes and do almost the same thing: github.com/lucasmazza/page.js
Oh okay ! I thought the idea was to create a JS file for each page. Makes sense now !
Thanks Ricardo !