jgallen23 / clientjade Goto Github PK
View Code? Open in Web Editor NEWcommand line tool to compile your jade templates into client side templates for use in the browser
Home Page: http://projects.jga.me/clientjade/
License: MIT License
command line tool to compile your jade templates into client side templates for use in the browser
Home Page: http://projects.jga.me/clientjade/
License: MIT License
I really like the nice module, but it seems that the jade engine defined in package.json is fixed at version 0.26.3.
As I know, the jade has been updated to 0.35.0,
So would you please update the package.json to get work with new jade version?
Thanks.
Jade can compile templates for client side as well: https://github.com/visionmedia/jade#browser-support
Can you upgrade Jade. By now you are using 1.5.0, and current release version is 1.9.2.
Hey, I love this library; wish it was more popular. Anyway, I thought I'd let you know that there's a higher-performance tweak to innerHTML that only requires a few line changes. Credit goes to this old article: http://blog.stevenlevithan.com/archives/faster-than-innerhtml
lib/browser/render.js
jade.templates = {};
jade.render = function(node, template, data) {
var newEl = node.cloneNode(false), //False means non-deep clone
parent = node.parentNode,
tmp = jade.templates[template](data);
newEl.innerHTML = tmp(data);
if (parent) parent.replaceChild(newEl, node);
return newEl;
};
Is this released under the MIT license? If so, please include the license in the repo and mark the files and documentation. Thanks!
Hey there,
First off, great library! Lightweight and exactly what I needed. However, there's a bug in your exports.merge function. In the current form it's written as:
exports.merge = function merge(a, b) {
var ac = a.class;
var bc = b.class;
if (ac || bc) {
ac = ac || [];
bc = bc || [];
if (!Array.isArray(ac)) ac = [ac];
if (!Array.isArray(bc)) bc = [bc];
ac = ac.filter(nulls);
bc = bc.filter(nulls);
a.class = ac.concat(bc).join(' ');
}
for (var key in b) {
if ('class' == key) continue;
a[key] = b[key];
}
return a;
};
You cannot use the .class notation because "class" is a reserved word in javascript. Some web browsers have no problem parsing this, but others do (confirmed on Mobile Safari). If you fix the notation to read:
var ac = a["class"];
var bc = b["class"];
....
a["class"] = ac.concat(bc).join(' ');
It'll compile correctly. Would definitely try to help myself, but I don't have access to the source. Right now, my only fix is to manually edit the code after each time I compile.
Not everyone like to render always. It would be good fi there where toHtml function
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.