diff --git a/packages/jael/angel_jael/CHANGELOG.md b/packages/jael/angel_jael/CHANGELOG.md index d93b153b..584dd6bd 100644 --- a/packages/jael/angel_jael/CHANGELOG.md +++ b/packages/jael/angel_jael/CHANGELOG.md @@ -1,8 +1,12 @@ # Change Log +## 4.2.3 + +* Turned on generated HTML minification by default + ## 4.2.2 -* Set default `cacheViews` to true +* Turned on JAEL template caching by default ## 4.2.1 diff --git a/packages/jael/angel_jael/README.md b/packages/jael/angel_jael/README.md index 0c578d5a..c20331cd 100644 --- a/packages/jael/angel_jael/README.md +++ b/packages/jael/angel_jael/README.md @@ -18,8 +18,7 @@ dependencies: ## Usage -Just like `mustache` and other renderers, configuring Angel to use -Jael is as simple as calling `app.configure`: +Just like `mustache` and other renderers, configuring Angel to use Jael is as simple as calling `app.configure`: ```dart import 'package:angel3_framework/angel3_framework.dart'; @@ -36,10 +35,10 @@ AngelConfigurer myPlugin(FileSystem fileSystem) { } ``` -`package:angel3_jael` supports caching views, to improve server performance. You might not want to enable this in development, so consider setting the flag to `app.isProduction`: +`package:angel3_jael` supports caching views and minified html output by default, to improve performance. You might want to disable them in development, so consider setting these flags to `false`: ```dart -jael(viewsDirectory, cacheViews: app.isProduction); +jael(viewsDirectory, cacheViews: false, minified: false); ``` Keep in mind that this package uses `package:file`, rather than `dart:io`. diff --git a/packages/jael/angel_jael/lib/angel3_jael.dart b/packages/jael/angel_jael/lib/angel3_jael.dart index ae51dc8c..64b7ab9a 100644 --- a/packages/jael/angel_jael/lib/angel3_jael.dart +++ b/packages/jael/angel_jael/lib/angel3_jael.dart @@ -19,7 +19,7 @@ AngelConfigurer jael(Directory viewsDirectory, bool cacheViews = true, Iterable patch = const [], bool asDSX = false, - bool minified = false, + bool minified = true, CodeBuffer Function()? createBuffer}) { var cache = {}; diff --git a/packages/jael/angel_jael/pubspec.yaml b/packages/jael/angel_jael/pubspec.yaml index 4ae6cf1f..dc01da49 100644 --- a/packages/jael/angel_jael/pubspec.yaml +++ b/packages/jael/angel_jael/pubspec.yaml @@ -1,5 +1,5 @@ name: angel3_jael -version: 4.2.2 +version: 4.2.3 description: Angel support for the Jael templating engine, similar to Blade or Liquid. homepage: https://angel3-framework.web.app/ repository: https://github.com/dukefirehawk/angel/tree/master/packages/jael/angel_jael diff --git a/packages/jael/angel_jael/test/all_test.dart b/packages/jael/angel_jael/test/all_test.dart index 228874e6..d3dbc486 100644 --- a/packages/jael/angel_jael/test/all_test.dart +++ b/packages/jael/angel_jael/test/all_test.dart @@ -46,7 +46,7 @@ void main() { }); await app.configure( - jael(viewsDirectory), + jael(viewsDirectory, minified: false), ); app.fallback((req, res) => throw AngelHttpException.notFound()); diff --git a/packages/jael/angel_jael/test/minified_test.dart b/packages/jael/angel_jael/test/minified_test.dart index e4d4f27d..9c87f82d 100644 --- a/packages/jael/angel_jael/test/minified_test.dart +++ b/packages/jael/angel_jael/test/minified_test.dart @@ -46,7 +46,7 @@ void main() { }); await app.configure( - jael(viewsDirectory, minified: true), + jael(viewsDirectory, cacheViews: true), ); app.fallback((req, res) => throw AngelHttpException.notFound()); @@ -63,7 +63,7 @@ void main() { test('can render', () async { var response = await client.get(Uri.parse('/github/thosakwe')); - print('Body:\n${response.body}'); + //print('Body:\n${response.body}'); expect( html.parse(response.body).outerHtml, html @@ -74,13 +74,15 @@ void main() { }); test('can render multiples', () async { - var response = await client.get(Uri.parse('/github/thosakwe')); - response = await client.get(Uri.parse('/github/thosakwe')); - response = await client.get(Uri.parse('/github/thosakwe')); - response = await client.get(Uri.parse('/github/thosakwe')); - response = await client.get(Uri.parse('/github/thosakwe')); + // Load the view template and wait for it to be cached + var response1 = await client.get(Uri.parse('/github/thosakwe')); - print('Body:\n${response.body}'); + for (var i = 0; i < 100; i++) { + client.get(Uri.parse('/github/thosakwe')); + } + var response = await client.get(Uri.parse('/github/thosakwe')); + + //print('Body:\n${response.body}'); expect( html.parse(response.body).outerHtml, html