Skip to content

Instantly share code, notes, and snippets.

@wearhere
Last active January 2, 2017 05:19
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 wearhere/a3684edd54787b698029e42ea6ccc0f3 to your computer and use it in GitHub Desktop.
Save wearhere/a3684edd54787b698029e42ea6ccc0f3 to your computer and use it in GitHub Desktop.
How to use https://github.com/mixmaxhq/rollup-plugin-handlebars-plus with jQuery loaded from a CDN.
var rollup = require('rollup');
var handlebars = require('rollup-plugin-handlebars-plus');
var nodeResolve = require('rollup-plugin-node-resolve');
// This can be whatever as long as it's consistent below.
var jqueryModuleId = 'jquery';
rollup({
entry: 'main.js',
external: [jqueryModuleId],
globals: {
// This assumes that jQuery is available as `window.$`.
[jqueryModuleId]: '$'
},
plugins: [
handlebars({
jquery: jqueryModuleId
}),
nodeResolve()
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment