Templating for Embla

Usage with Embla

export 'package:embla/bootstrap.dart';
import 'package:embla/http.dart';

import 'package:embla_templates/embla_templates.dart';
import 'package:embla_templates/engines/html_view_engine.dart';

get embla => [
  new HttpBootstrapper(
    pipeline: pipe(
      (ViewComposer view) { // Will be responding to each request

        return view.render('index');
      }
    )
  ),
  new TemplatingBootstrapper(
    templatesDirectory: 'web',
    engines: [
      HtmlViewEngine
    ]
  )
];

Usage without Embla

import 'dart:convert' show UTF8;

import 'package:embla_templates/embla_templates.dart';
import 'package:embla_templates/engines/html_view_engine.dart';

main() {
  final view = new ViewComposer.create(
    templatesDirectory: 'web',
    engines: [
      new HtmlViewEngine()
    ]
  );

  // Turn index.html into a Template -- a Future Shelf Response
  Template response = view.render('index');
}

Libraries

embla_templates
handlebars_view_engine
html_view_engine
json_view_engine
txt_view_engine