Hosting and Calling CSS & .js files from html
0
Hello.
Can we host our own CSS and .js fils and call them (link) from HTML?
The CSS editor inside your SASS is a bit cumbersome when working with a framework like Bootstrap as needs to have, bootstrap CSS, reset CSS, and Custom CSS ...ect
I have used platforms where both CSS editing/import options were available.
Thanks
matt
ie:
<link href="*/css/bootstrap-4.3.1.css" rel="stylesheet">
<link href="*/css/reset.css" rel="stylesheet">
Comments
Hi Matt
We can easily add our own CSS/Javascript file using Js-insertion page,you only need CSS/JS file url which you want to attach in Application.
Here is code Example which you can put in JS-Insertion ( https://help.directscale.com/hc/en-us/articles/360039160653-3-2-Inserting-JavaScript ) and it will load your CSS/JS files
To Add Javascript file
/**************************************Add Javascript file************************************************/
// Create new script Element
var script = document.createElement('script');
// set the attributes for script element
script.type = 'text/javascript';
// Add url of file
script.src = 'https://static.zdassets.com/hc/assets/jquery-d5395f0b7ac5027403fc17855c46dbfc.js';
// Append script element to HTML head
document.getElementsByTagName('head')[0].appendChild(script);
/**************************************Add Javascript file************************************************/
/**************************************Add CSS file************************************************/
var head = document.getElementsByTagName('HEAD')[0];
// Create new link Element
var link = document.createElement('link');
// set the attributes for link element
link.rel = 'stylesheet';
link.type = 'text/css';
// Add url of file
link.href = 'https://static.zdassets.com/hc/assets/application-cdc2ba8642f85d717c834f5c01941f79.css';
// Append link element to HTML head
head.appendChild(link);
/**************************************Add CSS file************************************************/
please let me know if you want more info on this.
Thanks
Please sign in to leave a comment.