jaded 0.1.2 copy "jaded: ^0.1.2" to clipboard
jaded: ^0.1.2 copied to clipboard

outdatedDart 1 only

Port of node.js popular Jade view engine for Dart.

jaded #

Port of the excellent Jade view engine in Dart.

Now feature complete with the original jade view engine, please refer to their detailed documentation to learn about Jade's features and syntax.

Although the aim was to have a high-fidelity port, the major syntactical difference compared with the original Jade (in JavaScript) is that the compiler only emits and executes Dart code, so any embedded code in views must be valid Dart (i.e. instead of JavaScript).

Installing via Pub #

Add this to your package's pubspec.yaml file:

dependencies:
  jaded: 0.1.2

Public API #

import jaded;

// Compile a function
var renderAsync = compile('string of jade', { //Compiler Defaults:    
	bool pretty: false,
	bool compileDebug: false,
	String doctype,
	String filename, 
	bool autoSemicolons: true
});

renderAsync(locals)
  .then((html) => print(html));

Options #

  • locals Local variable object
  • filename Used in exceptions, and required when using includes
  • debug Outputs tokens and function body generated
  • compileDebug When false no debug instrumentation is compiled
  • pretty Add pretty-indentation whitespace to output (false by default)
  • autoSemicolons Auto add missing semicolons at the end of new lines (true by default)

Web Frameworks #

  • jaded is the de-facto HTML View Engine in Dart express web framework.

Current Status #

All tests in jade.test.dart are now passing.

All integration test cases in /test/cases that doesn't make use of an external DSL library are passing, specifically:

filters.coffeescript.jade
filters.less.jade
filters.markdown.jade
filters.stylus.jade
include-filter-stylus.jade
include-filter.jade  //markdown

When they become available support for external Web DSL's can be added to transformers.dart in the same way as done inside Jade's feature-rich transformers.js.

Missing eval #

Jade relies on eval'ing code-gen to work which is a limitation in Dart that lacks eval.
To get around this, we're currently wrapping the code-gen Dart inside an Isolate and writing it out to a file then immediately reading it back in with spawnUri and invoking the new code asynchronously in the runCompiledDartInIsolate() method.

Although this works, it forces us to have an async API to convert jade to html at runtime. When Dart offers a sync API for evaluating Dart code we'll convert it back to a sync API.

Roadmap #

A pre-processor option to pre-generate all the html views at build time which will lets us provide a synchronous API and preload views in a cache avoiding compilation of jade at runtime.


Contributors #

2
likes
0
pub points
4%
popularity

Publisher

verified publishercheney-enterprises.com

Port of node.js popular Jade view engine for Dart.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

character_parser

More

Packages that depend on jaded