Skip to content

Instantly share code, notes, and snippets.

@adamotte
Last active August 29, 2015 14:22
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 adamotte/2907e031d4abdc8e37c5 to your computer and use it in GitHub Desktop.
Save adamotte/2907e031d4abdc8e37c5 to your computer and use it in GitHub Desktop.
Load json as require module
//You need to have text plugin
//Define your module as this
define("module_name", [
"text!../path/to/file.json"
], function(content){
return eval('('+ content +')');
});
//load it
define("main", ["module_name"], function(module){
console.log(module);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment