So Joomla 4 will have some help from node, particularly from Grunt, to manage the static files (call me css, images and javascript scripts). As is right now the Grunt script reads the source javascript file from a folder and minifies it in the same folder. This was our first (you can call it baby step) to node tools, it is improving every day and we are happy with that.
BUT we can do even better!
So, the minifying script has the ability to create source maps, which are supported by all the browsers that Joomla 4 will support, and that make me wonder why do we have to ship both the minified and the plain file when we have the ability to cut down the size of the deliverable (I haven't check the actual benefit, but it should be some MBs).
To the point:
src
or media-src
or something similar that will hold the source scripts.media
and will also create a source map file.Pros
Cons
Labels |
Added:
?
|
Category | ⇒ | Feature Request JavaScript |
+1 when you have the source maps all is good
According to the compile-js command you will save ~3 MB in J4 if you don't ship the uncompressed files.
The full 3.7.2 package (as well as the nightly 4.0) is around 12,5 MB.
Honestly, the argument of shipping a smaller file is a moot point. It just doesn't matter if that zip is 10 or 13 MB big.
Shipping class map files of course is fine as they help debugging for those knowing how to use them. But imho it's not worth removing the uncompressed files from the shipped package.
@yvesh not really helpful, I am not about client side debugging (it another topic), I am about writing the code for "xx" extension.
For now I can just open source file, and check what I need, with all "dev" comments and so on.
When source file will be removed, then I should OR restore source from map/min version, OR use browser dev tools. Which consume more time.
If chose between size and time, I would chose the time.
And about debugging. Most of Joomla users have no clue what is JavaScript
So:
Debugging scripts doesn't need to enable the debug option in the configuration!
it is also drawback. For average user (who got some bug) will be harder to explain, how to correctly post the issue. Because all he can do, it to post an error like "Error: Undefined variable at line 1".
ups: Joomla! is Open Source, we should not hide the source
I can't find the joomla4 browser requirements but are you sure that all supported browsers support using classmaps and especially does the browser support using classmaps without having to enable some hidden developer tool
But imho it's not worth removing the uncompressed files from the shipped package.
That is one of the benefits here, but not the only one
@Fedik we have to think a bit for the future here ES6 is coming upon us
@brianteeman IE11, Edge and the latest 2 versions of all the other major browsers (all support source maps)
without having to enable some hidden developer tool
??
without having to enable some hidden developer tool
Well in order to do any debugging client side you will have to use the hidden browser tools, so I really don't understand the question here
i give up
That is one of the benefits here, but not the only one
@dgt41 As far as I see, that's the only benefit with not shipping the files. The other benefits (shipping class maps files) can be done regardless of shipping the uncompressed ones. Or do I miss something here? Does shipping the uncompressed files somehow hinder "the future" of anything.
The other benefits (shipping class maps files) can be done regardless of shipping the uncompressed ones
Absolutely true!
Does shipping the uncompressed files somehow hinder "the future" of anything
Well, if we wanted to push the boundaries we could convert the source files to ES6 and then transpile them back to ES5 (because we need to support IE11 and IE11 is not supporting ES6).
Of course this needs some consideration (do we want to move fast, or have a slower adoption pace), but at some point (1-2-3 years, when IE11 will be dead) ES6 will be the common ground in the JS landscape. So in that context having an agreement on the foundations will be a good starting point.
Hope this comment makes some sense
does the browser support using classmaps without having to enable some hidden developer tool
not really, by default browser do not care about classmaps files, it do not required for work,
the browser request for the map file only when the developer tool is enabled,
so even IE6 will not fail
(1-2-3 years, when IE11 will be dead)
IE11 will be supported until the EOL of Windows 10. And Windows 10 will be supported until October 2025. So it has a few more years to live
They both are included in Windows 10. Edge is the default browser but IE11 is there as well.
IE11 is the last version of IE and will be supported until EOL of Windows 10.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-24 14:32:17 |
Closed_By | ⇒ | dgt41 |
Not sure.
I prefer to have a source file, to be able check something there quickly, while writing something based on "this" script. Sometimes it faster than googling for the doc for an actual version.
And the map file will be useless here.