4 ms·
Show HN: A django-inspired JavaScript templating system
- greut 15y agoIsn't "new Function" as evil as "eval" is evil? I guess when you call something a Compiler, it's allowed to do evilish stuff.
- deoxxa 15y agoIt's definitely evil, when it's used at runtime. In general (non-testing) usage, it would be written out to a file after compilation and there'd be no eval() action at runtime.
- itmag 15y agoWhy is eval evil? Because it's insecure? Inefficient?
- deoxxa 15y agoIt's mainly just slow - the whole set of code has to be parsed, processed, validated, run, etc every time it's used. It's not insecure in this usage (even if it were used on the client), as all the actual code is generated by uglify-js via an AST and it takes care of properly escaping everything.
- vicngtor 15y agoFor all I know Django's templating system is probably the worst templating system in the entire python web ecosystem.
- deoxxa 15y agoThe only thing I'm really taking from the django system is the syntax and some of the concepts. As far as I know, it's implemented completely differently. Very simple django/jinja2 templates will compile with Ginger, but the functionality is designed to be closer to Twig than anything.
- baddox 15y agoIf it's the worst, then they all must be pretty good, but I have always rather enjoyed Django's templates.