- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Adding jQuery 3 / How to prevent JavaScript automatic minifying
SOLVESep 13, 2018 4:04 AM
Hi there.
I recently encountered a problem with automatic JS formatting from HubSpot' s side.
Im am disabling loading jQuery old version which is automaticly included and adding JQuery 3.3.1. Im doing this trough a hubl template, replacing
{{ standard_header_includes|replace('/hs/hsstatic/jquery-libs/static-1.4/jquery/jquery-1.11.2.js', get_public_template_url('appxite_2018/js/vendor/jquery_3_3_1_min.js')) }}
While the browser clearly shows that the new jQuery is loaded and the old one is not, first I noticed that it changes the file from jquery_3_3_1_min.js to jquery_3_3_1_min.min.js . Furthermore, it changes the code inside. For example:
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");
is changed to
!function(b,a){"object"==typeof module&&"object"==typeof module.exports?module.exports=b.document?a(b,!0):function(c){if(!c.document){throw new Error("jQuery requires a window with a document")
And it causes JS to not function due to error - ReferenceError: a is not defined
Is there a way to stop Hubspot from minifying this or some other way to replace the older jQuery libraries to newest ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Sep 13, 2018 7:22 AM
@MartinsC - Just use the unminified version of jQuery 😄
https://code.jquery.com/jquery-3.3.1.js
If this answer helped, please, mark as solved 😄
tim@belch.io | forms.belch.io | Design your own Beautiful HubSpot Forms; No coding necessary.
Drop by and say Hi to me on slack.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content