embla_templates 0.1.5

  • README.md
  • Installing
  • Versions
  • 25

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: [
      HandlebarsViewEngine,
      HtmlViewEngine,
    ]
  ),
  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:


dependencies:
  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

Analysis

We analyzed this package on Jun 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
76 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
13 / 100
Overall score:
Weighted score of the above. [more]
25
Learn more about scoring.

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Error(s) in lib/engines/handlebars_view_engine.dart: Target of URI doesn't exist: 'package:mustache/mustache.dart'.

Suggestions

  • Fix platform conflicts.

    Error(s) prevent platform classification:

    Error(s) in lib/engines/handlebars_view_engine.dart: Target of URI doesn't exist: 'package:mustache/mustache.dart'.

  • Running dartdoc failed.

    Make sure dartdoc runs without any issues.

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 errors 23 hints.

    Make sure that the imported libraries are not in conflict. Error(s) in lib/engines/handlebars_view_engine.dart: Target of URI doesn't exist: 'package:mustache/mustache.dart'.

    Strong-mode analysis of lib/src/view_engine.dart failed with the following error:

    line: 70 col: 3
    Invalid override. The type of 'Template.then' ('((Response) → dynamic, {onError: Function}) → Future<dynamic>') isn't a subtype of 'Future<Response>.then' ('<R>((Response) → FutureOr<R>, {onError: Function}) → Future<R>').

    Similar analysis of the following files failed:

    • lib/embla_templates.dart (hint)
    • lib/engines/chalk_view_engine.dart (hint)
    • lib/engines/html_view_engine.dart (hint)
    • lib/engines/json_view_engine.dart (hint)
    • lib/engines/txt_view_engine.dart (hint)
    • lib/src/view_composer.dart (hint)
  • Package is getting outdated.

    The package was released 91 weeks ago.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use embla_templates.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0
embla ^0.2.3 0.2.3
template_cache ^0.1.1 0.1.1
Transitive dependencies
async 1.13.3 2.0.7
charcode 1.1.1
collection 1.14.10
convert 2.0.1
current_script 0.0.3
glob 1.1.6
http_parser 3.1.2
mime 0.9.6+1
path 1.6.1
shelf 0.6.8 0.7.3+1
shelf_static 0.2.7+1
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.7+1
string_scanner 1.0.2
typed_data 1.1.5
watcher 0.9.7+8
Dev dependencies
quark any
test any