Introducing the SAS Developer CDN
- Article History
- RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
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.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
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?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@AllanBowe No we don't yet publish the SRI hashes, but it's something we should consider. Thanks for the suggestion!