angel_mustache 2.0.0

mustache #

Gitter version build status

Mustache (Handlebars) view generator for the Angel web server framework.

Thanks so much @c4wrd for his help with bringing this project to life!

Installation #

In pubspec.yaml:

dependencies:
    angel_mustache: ^2.0.0

Usage #

const FileSystem fs = const LocalFileSystem();

configureServer(Angel app) async {
  // Run the plug-in
  await app.configure(mustache(fs.directory('views')));
  
  // Render `hello.mustache`
  await res.render('hello', {'name': 'world'});
}

Options #

  • partialsPath: A path within the viewsDirectory to search for partials in. Default is ./partials.
  • fileExtension: The file extension to search for. Default is .mustache.

2.0.0 #

  • Angel 2 and Dart 2 support.

example/main.dart

import 'package:angel_framework/angel_framework.dart';
import 'package:angel_mustache/angel_mustache.dart';
import 'package:file/file.dart';
import 'package:file/local.dart';

const FileSystem fs = const LocalFileSystem();

configureServer(Angel app) async {
  // Run the plug-in
  await app.configure(mustache(fs.directory('views')));

  // Render `hello.mustache`
  app.get('/', (req, res) async {
    await res.render('hello', {'name': 'world'});
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  angel_mustache: ^2.0.0

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:angel_mustache/angel_mustache.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Feb 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health issues and suggestions

Document public APIs. (-1 points)

2 out of 2 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/cache.dart. (-5.36 points)

Analysis of lib/src/cache.dart reported 11 hints, including:

line 9 col 3: Prefer using /// for doc comments.

line 15 col 39: Unnecessary new keyword.

line 16 col 42: Unnecessary new keyword.

line 21 col 13: 'isProduction' is deprecated and shouldn't be used.

line 31 col 15: 'isProduction' is deprecated and shouldn't be used.

Fix lib/angel_mustache.dart. (-1.99 points)

Analysis of lib/angel_mustache.dart reported 4 hints:

line 11 col 26: Use = to separate a named parameter from its default value.

line 11 col 60: Use = to separate a named parameter from its default value.

line 16 col 7: Unnecessary new keyword.

line 18 col 29: Unnecessary new keyword.

Fix lib/src/mustache_context.dart. (-0.50 points)

Analysis of lib/src/mustache_context.dart reported 1 hint:

line 2 col 8: Unused import: 'package:path/path.dart'.

Maintenance suggestions

Package is getting outdated. (-29.59 points)

The package was last published 67 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
angel_framework ^2.0.0-alpha 2.1.1
file ^5.0.0 5.1.0
mustache4dart ^3.0.0-dev 3.0.0-dev.1.0
path ^1.0.0 1.6.4
Transitive dependencies
_fe_analyzer_shared 1.0.3
analyzer 0.39.4
angel_container 1.1.0
angel_http_exception 1.1.0
angel_model 1.0.3
angel_route 3.1.0+1
args 1.5.2
async 2.4.0
build 1.2.2
build_config 0.4.2
build_daemon 2.1.3
build_resolvers 1.3.3
build_runner 1.7.4
build_runner_core 4.4.0
built_collection 4.3.2
built_value 7.0.9
charcode 1.1.3
checked_yaml 1.0.2
code_buffer 1.0.1
code_builder 3.2.1
collection 1.14.12
combinator 1.1.0
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
dart2_constant 1.0.2+dart2
dart_style 1.3.3
fixnum 0.10.11
glob 1.2.0
graphs 0.2.0
html 0.14.0+3
http2 1.0.0
http_multi_server 2.2.0
http_parser 3.1.3
http_server 0.9.8+3
intl 0.16.1
io 0.3.3
js 0.6.1+1
json_annotation 3.0.1
logging 0.11.4
matcher 0.12.6
merge_map 1.0.2
meta 1.1.8
mime 0.9.6+3
mock_request 1.0.6
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
package_resolver 1.0.10
pedantic 1.9.0
pool 1.4.0
pub_semver 1.4.3
pubspec_parse 0.1.5
quiver 2.1.2+1
quiver_hashcode 2.0.0
recase 2.0.1 3.0.0
reflectable 2.2.1+2
shelf 0.7.5
shelf_web_socket 0.2.3
source_span 1.6.0
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 1.1.0
string_scanner 1.0.5
term_glyph 1.1.0
timing 0.1.1+2
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.4
watcher 0.9.7+13
web_socket_channel 1.1.0
yaml 2.2.0
Dev dependencies
http any 0.12.0+4
test any