Permalink
Browse files

Set up css/js assets with less

See also
7dbab86
which was prematurely committed.
  • Loading branch information...
1 parent 7dbab86 commit ac5b241c8e7f649c379cc17875e8e76b131bec3b @kumar303 kumar303 committed Oct 10, 2012
View
@@ -13,6 +13,9 @@ build
*-all.css
*-min.js
*-all.js
+*.js.tmp
+*.css.tmp
+*.less.css
.noseids
tmp/*
*~
View
No changes.
View
@@ -0,0 +1,26 @@
+/* Python(ish) string formatting:
+ * >>> format('{0}', ['zzz'])
+ * "zzz"
+ * >>> format('{0}{1}', 1, 2)
+ * "12"
+ * >>> format('{x}', {x: 1})
+ * "1"
+ */
+var format = (function() {
+ var re = /\{([^}]+)\}/g;
+ return function(s, args) {
+ if (!s) {
+ throw "Format string is empty!";
+ }
+ if (!args) return;
+ if (!(args instanceof Array || args instanceof Object))
+ args = Array.prototype.slice.call(arguments, 1);
+ return s.replace(re, function(_, match){ return args[match]; });
+ };
+})();
+function template(s) {
+ if (!s) {
+ throw "Template string is empty!";
+ }
+ return function(args) { return format(s, args); };
+}
Oops, something went wrong.

0 comments on commit ac5b241

Please sign in to comment.