Why static-html has a dependency on JQuery?

Hello

I want to create a meteor application, using Riot or React as my template engine.
So in theory, I can get rid of Blaze and JQuery.

meteor create foo
cd foo
meteor remove insecure autopublish session blaze-html-templates jquery

So far, so good, JQuery is gone, and my app is only 70 kb after deploy.
But then, I need the static-html package, so I can add some stuff in the head and body of my page.

meteor add static-html

It works fine, but now, JQuery is back, and my app weight 103 kb.

I really don’t understand why static-html can possibly need JQuery.
Is it a bug?

I use meteor 1.2.1
I am not sure, but I think that with meteor 1.2.0, I didn’t have this problem.

Looking at atmosphere page for static-html in the bottom right hand corner of the page, it lists the dependencies as:

ecmascript
jquery
underscore
meteor
caching-html-compiler
templating-tools

https://atmospherejs.com/meteor/static-html

Does that help?

I found this:

But I still feel that there is something wrong here.
The HTML file comes from the server, so there is no need for JQuery to generate it.

I am pretty new to this, but as far as I understand it, when you install that package, it will install all the dependencies as well. Which is why people like the packaging system because it takes care of all that for you…

I agree that somewhat undermines the stated purpose of the package.

Mostly useful if you want to use Angular or React as your view layer and just want to get some static HTML content on your page as a render target for your view framework.

@sashko should be made aware…

I’m aware - there’s a github issue about it. Basically the static html package actually adds the body attributes via JavaScript, and that part depends on jquery. I’d love to accept a pull request changing that.

1 Like

I removed the official static-html package from my project and then replaced it by a custom package, in the packages folder.
This custom package is the same as the official one, except that I removed the JQuery dependency in package.js.
It works fine and JQuery is gone.
Of course, I can’t add attributes to the body tag anymore, but I don’t care.

2 Likes

Who needs attributes on the body tag?

This should be the default for static-html. The whole reason most of us use React is to get away from the inefficiencies and file size of jQuery.

The jquery dependency was removed from static-html in February; see:

1 Like

Without knowing for sure what the cause of not being able to remove jQuery is, I’ll just put this here in case these issues relate.

1 Like