Skip to content

Commit

Permalink
Merge pull request ingydotnet#9 from shannonmoeller/betterJsCompat
Browse files Browse the repository at this point in the history
Improved browser and CommonJS compatibility. Cleaned up whitespace.
  • Loading branch information
ingydotnet committed Jun 2, 2012
2 parents 3f9cc4c + 6b5610d commit e7bdf5d
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 78 deletions.
10 changes: 9 additions & 1 deletion lib/Jemplate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -402,17 +402,25 @@ sub _preamble {
Copyright 2006-2008 - Ingy döt Net - All rights reserved.
*/
var Jemplate;
;(function(){
var root = this,
Jemplate;
if (typeof(exports) == 'object') {
Jemplate = require("jemplate").Jemplate;
}
else {
Jemplate = root.Jemplate;
}
if (typeof(Jemplate) == 'undefined')
throw('Jemplate.js must be loaded before any Jemplate template files');
...
}

}());
1;

=head1 SYNOPSIS
Expand Down
Loading

0 comments on commit e7bdf5d

Please sign in to comment.