Skip to content

Instantly share code, notes, and snippets.

@commuterjoy
Last active January 4, 2016 22:08
Show Gist options
  • Save commuterjoy/8685338 to your computer and use it in GitHub Desktop.
Save commuterjoy/8685338 to your computer and use it in GitHub Desktop.
Previewing interactives on theguardian.com
require(['common/modules/interactive/loader', 'common/$'], function (Interactive, $) {
// remove the incumbent interactive
$('.interactive').empty();
// set the data- attribute to a boot module
$('.interactive').attr('data-interactive', 'http://path/to/boot.js');
// initialise the interactive
new Interactive(document.querySelector('figure.interactive'), document, guardian.config).init();
})
@commuterjoy
Copy link
Author

Because everything is an AMD module in NGW we can use web inspector to reload the interactive AMD module, change the figure data attribute (the path to boot.js) and re-load the interactive.

This can be used to test new versions of boot.js as well as test interactive.

Use http://proxylocal.com/ to access files on your localhost.

@theefer
Copy link

theefer commented Jan 29, 2014

Nice, worked for me, ta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment