Using bootstrap in Matrix


(Mahearnpad) #1

Hi

 

I'm using bootstrap framework for my site. It was working well until I made it live. Now bootstrap has lost the path to the glyphicons font libraries.  

 

Question is:  how do I set up the bootstrap and font libraries in Matrix, so that bootstrap knows where to find them?

 

I'm using css file assets for bootstrap, and file assets for the glyphicon files.  Is this correct, or should I be using some other asset types?

 

thanks

Michael


(Joel Porgand) #2

the paths in the css will have broken as the under construction assets will be served with a regular matrix path but the live assets get a __data path by default

 

your best bet is probably to use a css design asset, and add the icons etc. underneath it - that way you can reference them in the css like mysource_files\myicon.png

 

if you use a css file asset you'll have to hardcode the paths - with publicly served files that gets to be a pain as they will have horrible __data/* paths. 


(Nic Hubbard) #3

Don't use CSS Design assets or even CSS files for this. Use the Bootstrap provided CDN which includes all the glyphicons. Will be much faster than loading it from Matrix as well:

 

https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css


(Mahearnpad) #4

Thanks Nic and J.P.  

 

I ended up putting in the full matrix server paths inside a @font-face rule in my css, which seems to work OK.  I like the CDN approach though, might end up doing that.


(Joel Porgand) #5

Use the Bootstrap provided CDN which includes all the glyphicons. 

 

yeah that's probably a better idea.


(Peter McLeod) #6
We originally just used the CDN method, but ended up bringing it into matrix using the mysource_files/ method to replace the links.
 
One problem we found was due to the operating environments of key user groups - where their proxy servers/firewalls were blocking content from various sources including CDNs and certain google services (such as analytics)... a large portion still use IE8 as well (fun times).
 
All traffic from our domain was whitelisted so it ended up just be easier to serve it from Matrix.
 
You sacrifice a bit of loading speed, but not a huge issue once it's cached. There is also the hassle of repeating the process if you want to upgrade bootstrap versions.
 
Thanks
Peter