-
Notifications
You must be signed in to change notification settings - Fork 6
Adding Static files to CDN
Content Delivery Networks (CDNs) have revolutionized web hosting during the past few years. Rather than hosting Sunbird in a single server, you can distribute the files and load across multiple systems. Sunbird static resources such as images, CSS files and JavaScript, common JavaScript libraries, fonts and other assets can be hosted in CDN
The default gulp task creates dist files which contains the files to be hosted in CDN. After caoncatinating and minifiying the js and css files to dist folder it will create cdn folder files with dist Source Code and all libraries as two JS files, CSS and Images.
The deployment of step consists of uploading of the static files prepeared as cdn folder and kept inside dist folder, each deployment can use cdn folder to upload files to there cdn server and update the file references.
We can use gulp or any script to upload files to CDN server and update the index.ejs
files inside private and public folders with cdn url as prefix to css and js files. fonts and images inside css can be loaded from cdn with relative url, CDN url added as prefix to the image tag inside each html file. Server side script contains sunbird_cdn_url
as environment variable which will be sent to client to serve images as prefix url.