diff --git a/slides/README.md b/slides/README.md index 55e5f0f8..650d2d7d 100644 --- a/slides/README.md +++ b/slides/README.md @@ -45,3 +45,12 @@ and publish them to http://container.training/. Pull requests are automatically deployed to testing subdomains. I had no idea that I would ever say this about a static page hosting service, but it is seriously awesome. ⚡️💥 + + +## Extra bells and whistles + +You can run `./slidechecker foo.yml.html` to check for +missing images and show the number of slides in that deck. +It requires `phantomjs` to be installed. It takes some +time to run so it is not yet integrated with the publishing +pipeline. \ No newline at end of file diff --git a/slides/slidechecker.js b/slides/slidechecker.js new file mode 100755 index 00000000..71ef205c --- /dev/null +++ b/slides/slidechecker.js @@ -0,0 +1,21 @@ +#!/usr/bin/env phantomjs +var system = require('system'); +var filename = system.args[1]; +var url = 'file://' + system.env.PWD + '/' + filename; + +var page = require('webpage').create(); + +page.onResourceError = function(resourceError) { + console.log('ResourceError: ' + resourceError.url); +} + +console.log('Loading: ' + url); +page.open(url, function(status) { + console.log('Loaded: ' + url + '(' + status + ')'); + var slides = page.evaluate(function() { + return document.getElementsByClassName('remark-slide-container'); + }); + console.log('Number of slides: ' + slides.length); + console.log('Done: ' + url + '(' + status + ')'); + phantom.exit(); +});