Mapache
Mapache copied to clipboard
Load Prism from CDN
Is it possible to load prism from a CDN?
I have used the code injection and it seems that at least the style gets overwritten. However when I start to add plugins the things start to break.
The example above is when I try to load the plugin match braces.
Also, line numbers do not work.
Thanks for the amazing job with the theme.
Hi @tstoco
To use Prismjs from a CDN.
Replace this line of code with this.
var sitePrismJscomponents = 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.15.0/components/';
https://github.com/godofredoninja/Mapache/blob/495ce6a29f7cbe6cb0adf84443913a4920089566/default.hbs#L74
hi @godofredoninja,
Thanks for the update.
However, I decided to completely remove the lines below from default.hbs
:
var sitePrismJs = '{{asset "scripts/prismjs.js"}}';
var sitePrismJscomponents = '/assets/scripts/components/';
And use the code injection functionally from ghost to get it to work.
Let's say that I want to load just a few modules :
- Auto Loader ;
- Toolbar ;
- Line Numbers ;
- Show Language ;
- Copy to Clipboard ;
How would I achieve that?
Declaring multiple sitePrismJscomponents
like :
var sitePrismJs = 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.15.0/components/prism-core.min.js' ;
var sitePrismJscomponents = 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.15.0/plugins/prism-autoloader.min.js' ;
...
Also, we should account that we need to load stylesheets for certain modules like line-numbers
, toolbar
...