Skip to content

Instantly share code, notes, and snippets.

@Hypercubed
Last active January 6, 2016 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hypercubed/76a1bf7b7d276b1548a0 to your computer and use it in GitHub Desktop.
Save Hypercubed/76a1bf7b7d276b1548a0 to your computer and use it in GitHub Desktop.
systemjs-twitter-widgets
System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: false,
paths: {
"twitter": "//platform.twitter.com/widgets.js" // must be a path, map will cause an error when bundling (May change in SystemJS Builder v0.15)
},
meta: {
"twitter": {
"build": false, // don't build (May not be needed in SystemJS Builder v.15)
"scriptLoad": true, // load in a script tag to avoid XHR error (option, SystemJS assumes script load when format: 'global')
"format": "global",
"exports": "twttr"
}
}
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>systemjs-twitter-widgets</title>
<base href=".">
</head>
<body>
<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">Load JavaScript Interfaces for Twitter for Websites using SystemJS. <a href="https://t.co/VgCXv94IsP">https://t.co/VgCXv94IsP</a></p>&mdash; Jayson Harshbarger (@hypercubed) <a href="https://twitter.com/hypercubed/status/684564471746985986">January 6, 2016</a></blockquote>
<script src="//cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.js"></script>
<script src="config.js"></script>
<script>
System.import('./index')
.then(null, console.error.bind(console));
</script>
</body>
</html>
require('twitter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment