Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+ jsDelivr usage instructions #569

Closed
wants to merge 1 commit into from
Closed

Conversation

tomByrer
Copy link
Contributor

Currently versions hosted on jsDelivr are 2.2-2.5.
I don't really have time to also push on cdnjs, so I went with the network with 0 downtime & lower latency.

@tomByrer tomByrer mentioned this pull request Aug 29, 2013
@hakimel
Copy link
Owner

hakimel commented Sep 4, 2013

Thanks for taking the time to add these but I unfortunately I've decided not to add this to the readme. Serving assets from a CDN is good practice but I don't think it is very important for the typical use case of reveal.js. It also means all those resources would need to be kept up to date as the framework is updated.

If the reveal.js consisted of single concatenated CSS and JS files I would have been for dropping this in, but as the framework is currently structured you'd need to change so many different paths for this to work that I think few people will bother.

@hakimel hakimel closed this Sep 4, 2013
@tomByrer
Copy link
Contributor Author

tomByrer commented Sep 4, 2013

Thanks for your consideration!

@lsorber
Copy link

lsorber commented Jun 21, 2016

I would actually be interested in a jsdelivr-hosted reveal.js, it would be much more convenient to me than cloning the repo every time I create a new presentation. It would also allow users to have a folder with presentation htmls without any dependency clutter on the filesystem.

@tomByrer Any chance you could update jsdelivr to match the latest reveal.js release?

@tomByrer
Copy link
Contributor Author

You or @hakimel can update the files to allow auto-updating. Sorry I'm swamped now.

@patarapolw
Copy link

patarapolw commented Sep 25, 2019

I believe there should be instructions on this for https://github.com/hakimel/reveal.js#client-presentation for Served from a publicly accessible static file server. Examples include: GitHub Pages, Amazon S3, Dreamhost, Akamai, etc.

For example, on the example index.html or demo.html, you can put

<script>
var revealCDN = "";  // Replace with 'https://cdn.jsdelivr.net/npm/reveal.js@VERSION_NUMBER/' if you need a CDN for jsDelivr.
var revealCSS = [
  { href: "css/reset.css" },
  { href: "css/reveal.min.css" },
  { href: "css/theme/white.css", id: "theme" },
  { href: "lib/css/monokai.css", id: "highlightTheme" },
  { href: window.location.search.match(/print-pdf/gi) ? 'css/print/pdf.css' : 'css/print/paper.css' }
];

revealCSS.forEach(function (css) {
  css.href = revealCDN + css.href;
  document.getElementsByTagName('head')[0].appendChild(Object.assign(document.createElement('link'), {
    rel: "stylesheet",
    type: "text/css",
    ...css
  }));
});

document.getElementsByTagName('head')[0].appendChild(Object.assign(document.createElement('script'), {
  type: "text/javascript",
  src: revealCDN + "js/reveal.min.js"
}));
</script>

<script>
...
Reveal.initialize({
    ...data,
    dependencies: [
        { src: `${revealCDN}plugin/markdown/marked.js` },
        { src: `${revealCDN}plugin/markdown/markdown.js` },
        { src: `${revealCDN}plugin/notes/notes.js`, async: true },
        { src: `${revealCDN}plugin/highlight/highlight.js`, async: true }
    ]
});
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants