Created
October 28, 2014 19:32
-
-
Save geddski/357bc2ba1fe2b4086182 to your computer and use it in GitHub Desktop.
simple Angular template loader for webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Import an Angular template. | |
* Returns the HTML as a string | |
* Could be chained with a separate loader if you want to populate Angular's template cache | |
*/ | |
module.exports = function(source) { | |
var html = "'" + source.replace(/"/g, '\\\"').replace(/\n/g, '\\') + "'"; | |
return "module.exports = \"" + html + "\""; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use like so:
...
template: require('template!./path/to/template.html')
...