mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-21 22:07:13 +00:00
Add script to check images and show slide count
This commit is contained in:
@@ -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.
|
||||
21
slides/slidechecker.js
Executable file
21
slides/slidechecker.js
Executable file
@@ -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();
|
||||
});
|
||||
Reference in New Issue
Block a user