jael 2.0.2 copy "jael: ^2.0.2" to clipboard
jael: ^2.0.2 copied to clipboard

A simple server-side HTML templating engine for Dart. Comparable to Blade or Liquid.

jael #

Pub build status

A simple server-side HTML templating engine for Dart.

See documentation.

Installation #

In your pubspec.yaml:

dependencies:
  jael: ^2.0.0

API #

The core jael package exports classes for parsing Jael templates, an AST library, and a Renderer class that generates HTML on-the-fly.

import 'package:code_buffer/code_buffer.dart';
import 'package:jael/jael.dart' as jael;
import 'package:symbol_table/symbol_table.dart';

void myFunction() {
    const template = '''
<html>
  <body>
    <h1>Hello</h1>
    <img src=profile['avatar']>
  </body>
</html>
''';

    var buf = CodeBuffer();
    var document = jael.parseDocument(template, sourceUrl: 'test.jael', asDSX: false);
    var scope = SymbolTable(values: {
      'profile': {
        'avatar': 'thosakwe.png',
      }
    });

    const jael.Renderer().render(document, buf, scope);
    print(buf);
}

Pre-processing (i.e. handling of blocks and includes) is handled by package:jael_preprocessor..

5
likes
40
pub points
0%
popularity

Publisher

verified publisherangel-dart.dev

A simple server-side HTML templating engine for Dart. Comparable to Blade or Liquid.

Homepage

License

MIT (LICENSE)

Dependencies

args, charcode, code_buffer, source_span, string_scanner, symbol_table

More

Packages that depend on jael