BookmarkSubscribeRSS Feed

Introducing the SAS Developer CDN

Started ‎05-24-2022 by
Modified ‎05-24-2022 by
Views 12,329

Content Delivery Networks (CDN) are commonplace in web development today and help power most of the modern web. They provide systems of distributed servers that cache content at locations around the world, helping to speed up web content delivery by minimizing network latency. As a web developer, you may have even used one before when loading JavaScript libraries. SAS JavaScript libraries like the SAS Visual Analytics SDK and SAS Content SDK are deployed to NPM, which allows developers to directly install these packages in their development environments.  But it also allows them to access the libraries through freely available CDNs that mirror NPM, such as unpkg and jsDelivr. If you have used the SAS Visual Analytics SDK or the SAS Content SDK you may be familiar with the following HTML tag:

 

<script src="https://unpkg.com/@sassoftware/va-report-components@latest/dist/umd/va-report-components.js"></script>

 

This script tag loads the SAS Visual Analytics SDK from the unpkg CDN. It is a convenient alternative to installing the library from NPM and hosting it with your web page.

 

What should I use instead?

 

The unpkg CDN still will continue to work but it is no longer the recommended option for loading SAS JavaScript SDK libraries. Instead, load your SAS JavaScript SDK libraries from the SAS Developer CDN.

 

Benefits of using the SAS Developer CDN

  • Increased file compression for reduced network payload
  • Global edge caching to minimize network latency
  • Faster load times, specifically for uncached files

 

Specifying packages by version

 

SAS JavaScript library package URLs have the form:

https://cdn.developer.sas.com/packages/${PACKAGE-NAME}/${VERSION}/${FILE-PATH}

Here are examples for the SAS Visual Analytics SDK and SAS Content SDK:

 

<script src="https://cdn.developer.sas.com/packages/va-report-components/1.8.0/dist/umd/va-report-components.js"></script>
<script src=” https://cdn.developer.sas.com/packages/content-sdk/0.5.0/dist/umd/content-sdk-components.js”></script>

 

Specifying packages by distribution tag

 

SAS JavaScript library packages can also be referenced by an NPM distribution tag. Distribution tags vary between NPM packages, but all packages have a latest tag that identifies the most recent release. SAS JavaScript library package URLs referencing a distribution tag have the form:

https://cdn.developer.sas.com/packages/${PACKAGE-NAME}/${DIST-TAG}/${FILE-PATH}

Here is an example of loading the SAS Visual Analytics SDK using the latest distribution tag:

 

<script src="https://cdn.developer.sas.com/packages/va-report-components/latest/dist/umd/va-report-components.js"></script>

 

If you already utilize SAS JavaScript SDK libraries, I suggest that you make this simple change today and start using the SAS Developer CDN! For more information about SAS SDKs and APIs, visit the SAS Developer Portal.

Comments

Nice - useful for avoiding CORS issues!  Assuming the client has external internet access.

 

We host the SASjs Adapter on jsdelivr: https://www.jsdelivr.com/package/npm/@sasjs/adapter - but usually it just gets bundled into our deployed apps.

 

One nice thing about commercial CDNs is that they provide the necessary SRI (SubResource Integrity) hashes.  Does the SAS CDN provide these also?  

@AllanBowe No we don't yet publish the SRI hashes, but it's something we should consider.  Thanks for the suggestion!

Version history
Last update:
‎05-24-2022 03:02 PM
Updated by:
Contributors

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags