embla_templates 0.1.5

  • README.md
  • Installing
  • Versions
  • 0

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';
import 'package:embla_templates/engines/handlebars_view_engine.dart';

get embla => [
  new TemplatingBootstrapper(
    templatesDirectory: 'web',
    engines: [
  new HttpBootstrapper(
    pipeline: pipe(
      (ViewComposer view) { // Will be responding to each request

        // Given the configuration in the TemplatingBootstrapper,
        // `render` will look for `web/index.hbs` or `web/index.html`
        return view.render('index')
          ..localVariableThatWillBeAvailableInTheTemplate = "value";

Usage without Embla #

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

import 'package:shelf/shelf.dart' as shelf;

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

  // Turn index.html into a Template -- a Future Shelf Response
  Template template = view.render('index')
    ..localVariableThatWillBeAvailableInTheTemplate = "value";

  // Future<shelf.Response> is a valid return value in a shelf.Handler
  shelf.Response response = await template;

Use this package as a library

1. Depend on it

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

  embla_templates: ^0.1.5

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:embla_templates/embla_templates.dart';
Version Uploaded Documentation Archive
0.1.5 Sep 16, 2016 Go to the documentation of embla_templates 0.1.5 Download embla_templates 0.1.5 archive
0.1.4 Mar 11, 2016 Go to the documentation of embla_templates 0.1.4 Download embla_templates 0.1.4 archive
0.1.3 Mar 4, 2016 Go to the documentation of embla_templates 0.1.3 Download embla_templates 0.1.3 archive
0.1.2 Feb 24, 2016 Go to the documentation of embla_templates 0.1.2 Download embla_templates 0.1.2 archive
0.1.1 Feb 1, 2016 Go to the documentation of embla_templates 0.1.1 Download embla_templates 0.1.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0