Permalink
Browse files

adding jquery-tmpl as a submodule and a build step to keep everything…

… up to date
  • Loading branch information...
1 parent 6ff0495 commit 8e211a8be89d63695f583c0132c63deab3e60e37 Sam Breed committed Jul 10, 2011
Showing with 39 additions and 13 deletions.
  1. +3 −0 .gitmodules
  2. +21 −0 Cakefile
  3. +6 −0 lib/head.js
  4. +6 −11 lib/jquery.tmpl.js
  5. +2 −2 package.json
  6. +1 −0 vendor/jquery-tmpl
View
@@ -0,0 +1,3 @@
+[submodule "vendor/jquery-tmpl"]
+ path = vendor/jquery-tmpl
+ url = https://github.com/jquery/jquery-tmpl.git
View
@@ -42,7 +42,28 @@ task 'build', 'Pre compile jQuery Templates', ->
handleError(err) if err
util.log "#{targetDir}/templates.js written"
+task 'build:dev', 'adds common js module support to jquery-tmpl', ->
+ files = ["lib/head.js", "vendor/jquery-tmpl/jquery.tmpl.js"]
+ data = []
+
+ for file, index in files then do (file, index)->
+
+ fs.readFile file, 'utf8', (err, fileContents) ->
+ handleError(err) if err
+ data[index] = fileContents
+
+ process( data.join('') ) if index is files.length - 1
+
+ process = ( data ) ->
+ fs.writeFile "lib/jquery.tmpl.js", data, 'utf8', (err) ->
+ handleError(err) if err
+ util.log "lib/jquery.tmpl.js written"
+
+
handleError = (error) ->
util.log error
displayNotification error
+
+
+
View
@@ -0,0 +1,6 @@
+try {
+ if (module && module.exports) {
+ jQuery = require('jquery');
+ module.exports = jQuery;
+ }
+} catch(e) {}
View
@@ -1,3 +1,9 @@
+try {
+ if (module && module.exports) {
+ jQuery = require('jquery');
+ module.exports = jQuery;
+ }
+} catch(e) {}
/*!
* jQuery Templates Plugin 1.0.0pre
* http://github.com/jquery/jquery-tmpl
@@ -7,16 +13,6 @@
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
-
-// Adding Node.js Compatability
-try {
- if (module && module.exports) {
- jQuery = require('jquery');
- module.exports = jQuery;
- window = {};
- }
-} catch(e) {}
-
(function( jQuery, undefined ){
var oldManip = jQuery.fn.domManip, tmplItmAtt = "_tmplitem", htmlExpr = /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
newTmplItems = {}, wrappedItems = {}, appendToTmplItems, topTmplItem = { key: 0, data: {} }, itemKey = 0, cloneIndex = 0, stack = [];
@@ -492,4 +488,3 @@ try {
jQuery( coll ).remove();
}
})( jQuery );
-
View
@@ -8,10 +8,10 @@
"url": "github.com:wookiehangover/jquery-tmpl-jst.git"
},
"engines": {
- "node": "~0.4.8"
+ "node": "~0.4.9"
},
"dependencies": {
- "jquery": "~1.5.1",
+ "jquery": "~1.6.2",
"coffee-script": "~1.1.1"
},
"devDependencies": {},
Submodule jquery-tmpl added at 07d08c

0 comments on commit 8e211a8

Please sign in to comment.