imakewebthings / deck.js

Modern HTML Presentations

Home Page:http://imakewebthings.com/deck.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Script and plugin loading order

gchallen opened this issue · comments

This is a great tool and I've been happily using it to write slides for my class for several years. So thank you.

However, I've been running into a script problem with loading deck.js and jQuery. As part of the Metalsmith pipeline that I use to build my site, I was previously combining and minifying all the JavaScript needed for my deck.js slides to reduce page load times and round-trips, using filenames to keep things in order. I start with Modernizr, then add jQuery, the deck.js core, and then the plugins I use. Then everything gets minified together. This works fine on my local (HTTP) server.

Unfortunately it completely breaks when I move things to my main HTTPS server. If I combine everything together deck.js core seems to not be able to find jQuery. If I load jQuery first, then a later deck.js plugin can't find the main deck.js plugin. Loading everything in order at the end of the body tags works, but of course generates the unfortunate amount of network round trips I'm trying to avoid.

Any ideas about how to address this problem? Honestly I don't really even know what's going wrong. FWIW a similar approach (combine in order, minify) works for the rest of my site which uses jQuery and then Bootstrap (which depends on jQuery).

Thanks in advance for any help.

It's a nice surprise to see that you are also using several extensions of mine, thanks. Feedback is welcome if you have suggestions (I already plan to refresh the documentation about these extensions, when I find time). Even if it is not a exact solution, I can contribute some comments that might help here.

  1. I used to observe heavy performance issues (due to loading a lot of files) when deploying presentations on a server, so, I ended-it up doing a single-file version of deck.js+extensions for this purpose [1], solving loading time issues and also some bugs (probably the browser handling slow loading strangely). I guess, your combine+minify pipeline plays this role anyways.
  2. I encountered a conflict between bootstrap and deck.js (due to both using jquery), and, if I remember well (this was in a very specific context [2]), including deck.js with its jquery and only then bootstrap without its jquery, solved the issue.

[1] https://github.com/twitwi/deck.js-packed#notes-on-how-the-packed-version-is-built
[2] https://github.com/twitwi/lesson-template/blob/0a08d76fd19b95d659147f2037f25fbb206e0bfe/_includes/as-slides.html

Thanks for the reply. This is a great toolset! Thanks for creating and sharing it.

I'm closing it since this was a problem with my pipeline which was concatenating files without sorting them. So my bad. Properly ordered, everything works fine. (Duh.)