Jump to content

Using Multiple Javascript Files and NPM modules

Recommended Posts

Posted

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?

Posted
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 (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

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.