@Jesse about jQuery dependency

15 views
Skip to first unread message

12u...@gmail.com

unread,
Dec 16, 2020, 12:49:06 PM12/16/20
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

In a former post, you talked about may be get rid of jQuery dependency.

At first, I was thinking it as a good thing, but on second thought, not that much : I'm at this time looking after some specific JS &| CSS snippets on the web (such as display a table as a tree - found some fine things on: https://www.cssscript.com/tag/tree-view/) and observe that most of them (~95%), even those working with Bootstrap, are in fact closely tied to the jQuery JS - which seems logical, as jQuery is here since a long time and very popular from what I read.

So, may be extending the existing would be a better option, such as adding Bootstrap, and may be also add nicer mobile library -- although, I'm conscious this might imply a lot of work - I will take the opportunity of this dev and the book (minus 2 days before ETA:) to see if I can manage to correctly program some new widgets).

With regards,

Jean-Yves

Precision just in case it wasn't obvious, as Prentice seems to have taken it first degree : I was kidding all the time about "not working enough".
As a non-programmer, I fully understand that founding enough time to be fully focused on a task, sometime not so interesting but compulsory to achieve, isn't something easy.

Jesse Gumm

unread,
Dec 16, 2020, 1:06:08 PM12/16/20
to nitrogenweb
Hey Jean-Yves,

First, I absolutely understood your comments as joking regarding "Not working enough!" - no offense taken at all from that.

Regarding the removing jquery, this is merely something I'm looking to explore at this point.  I believe most of what we do that relies on jquery does not need to rely on jquery any longer.  That said, even if I remove jquery as a requirement, there's nothing preventing jquery from being used with Nitrogen.  i'm merely looking to decouple Nitrogen from jquery as much as possible.  But if it proves too difficult, or not worth the effort, then, of course, it would be abandoned.

As for extending it, I don't see building bootstrap directly into Nitrogen, but use bootstrap with a plugin. For my own purposes, I use https://github.com/choptastic/coldstrap and build out missing elements as I need them.  I am considering adding additional "initializations" to the project creation though.  For example, something like: `make slim_cowboy FRONTEND=boostrap` - something along those lines, which would set up the site, and build it with bootstrap intregration from the get-go (likely using my coldstrap plugin).

Something like that.

-Jesse

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nitrogenweb/eb21db26-911f-4fb4-9a41-2a0e0342353dn%40googlegroups.com.


--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

12u...@gmail.com

unread,
Dec 17, 2020, 11:18:13 AM12/17/20
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hey Jesse,

> I believe most of what we do that relies on jquery does not need to rely on jquery any longer.  That said, even if I remove jquery as a requirement, there's nothing preventing jquery from being used with Nitrogen.

As a matter of fact, what I'm really worry about is : does it mean that all Nitrogen primitives concerning jQuery will go with it or not ? (I wouldn't like to be obliged to develop myself such components as I don't feel tough enough to do so at this time - my bad, as I don't work very much w/ Nitrogen in particular and neither other languages in general these days).


Fortunately, I keep a total e-mails history, so it is already included in my deps.

> and build out missing elements as I need them.

Well, I hope there's a thorough explanation on how to build them in zebook (ETA: tomorrow), because the actual doc is quite short about that (it is also time for me to seriously dive in the code to try to fully understand how a component operates, especially when some Bootstrap &| jQuery are including JS on top of CSS, although a correct operation is reachable by mixing the plugin with existing Nitrogen elements).

> For example, something like: `make slim_cowboy FRONTEND=boostrap`

This would be nice.

> (likely using my coldstrap plugin).

One thing that would be very nice would be to be able to get all the components you made when needed those years, this would make Nitrogen even closer to a Lego framework.
IF it is a matter of missing free time, I'm ok to publish them myself on hitgub (with all credits going to you, of course) - time to learn how to USE github…

With regards,

Jean-Yves

Jesse Gumm

unread,
Dec 17, 2020, 1:35:37 PM12/17/20
to nitrogenweb
Hey Jean-Yves,
 
As a matter of fact, what I'm really worry about is : does it mean that all Nitrogen primitives concerning jQuery will go with it or not ? (I wouldn't like to be obliged to develop myself such components as I don't feel tough enough to do so at this time - my bad, as I don't work very much w/ Nitrogen in particular and neither other languages in general these days).

No, of course not.  My goal is not to eliminate the functionality, but replace what can be replaced with browser primitives.

If something does indeed absolutely depend on jquery, it could be loaded dynamically when the dependent action calls for it.  But ideally, eliminating jquery as a base requirement would lighten the overall load (I love fast pages that don't download a billion javascript files).
 
Well, I hope there's a thorough explanation on how to build them in zebook (ETA: tomorrow), because the actual doc is quite short about that (it is also time for me to seriously dive in the code to try to fully understand how a component operates, especially when some Bootstrap &| jQuery are including JS on top of CSS, although a correct operation is reachable by mixing the plugin with existing Nitrogen elements).

There is.  Chapter 14 covers building custom elements, and chapter 15 covers converting those custom elements to plugins.

One thing that's slightly different from coldstrap to other elements is that coldstrap redefines a lot of elements to be bootstrap versions using the rekt parse transform (with the helper macro ?WF_EXTEND).  That way, you don't have to copy and paste the whole #button{} element definition to make the #btn{} element.

The include file that defines all the element is here: https://github.com/choptastic/coldstrap/blob/master/include/records.hrl
That should demonstrate how the ?WF_EXTEND macro works.

Then to see how a simple element like #button{} is redefined to the bootstrappified #btn{}, check out: https://github.com/choptastic/coldstrap/blob/master/src/element_btn.erl

So the chapter in the book covers the basics of custom elements and plugins, and the above shortcuts show a little more advanced methods building on that foundation.

I hope that helps,

-Jesse


 

12u...@gmail.com

unread,
Dec 17, 2020, 1:50:31 PM12/17/20
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

> No, of course not.  My goal is not to eliminate the functionality, but replace what can be replaced with browser primitives.

Ahhh, I feel much better ;)

> (I love fast pages that don't download a billion javascript files).

I totally agree with you as I sometimes slurp an important page to keep an offline doc and some are really frightening when you make a : du -sh /page_files_dir.

> There is.  Chapter 14 … Chapter 15 …

Excellent !

> using the rekt parse transform (with the helper macro ?WF_EXTEND).

This is one of the few things I really understood.
Thanks for the URLs.

With regards,

Jean-Yves
Reply all
Reply to author
Forward
0 new messages