Jump to content

Using Multiple Javascript Files and NPM modules

Recommended Posts

I am inheriting control of a Squarespace website using version 7.1. I need to add some slightly complex Javascript code to one of the pages. I have 6 different Javascript files and I am using 10 different NPM libraries. 

The functionality of the page is for the user to input a website and then the JS code will scrape the website and do some analysis on that website.

My question is - What is the best way to handle this situation?

Link to comment
4 hours ago, mikegriff3 said:

I am inheriting control of a Squarespace website using version 7.1. I need to add some slightly complex Javascript code to one of the pages. I have 6 different Javascript files and I am using 10 different NPM libraries. 

The functionality of the page is for the user to input a website and then the JS code will scrape the website and do some analysis on that website.

My question is - What is the best way to handle this situation?

I suggest you use a JS bundler like webpack to combine all the packages into single file.

Then you can use Squarespace Link editor to upload the js file or upload it on some free hosting and link it to your site in the Footer Injection

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.