Dev

Fresh web framework for Deno speeds page loading


With Fresh 1.4, the latest version of the full-stack web framework leveraging the Deno javaScript/TypeScript runtime, the Fresh authors are heralding faster page loads and shared layouts.

Introduced August 16, Fresh 1.4 is focused on developer experience and ease of use in shared layouts, route-specific islands, and other capabilities. For faster page loading, pre-compiling resulted in assets being served 45 to 60 times faster than just-in-time rendering for a cold start of a serverless function, the Fresh team said. The savings depend on the size of the “islands,” or interactive components, being delivered.

For layouts, Fresh 1.4 adds support for _layout files, which can be described as a route local app wrapper. These can be put in any route folder, with Fresh detecting all layouts that match and stack them atop each other.

Falling under the umbrella of Deno technologies, Fresh is a combination of a routing framework and templating engine that renders pages on demand. Projects can be deployed manually to any platform with deno. An edge runtime such as Deno Deploy provides the best experience.

Developers can start a Fresh project by running deno run -A -r https://fresh.deno.dev or update an existing project by running deno run -A -r https://fresh.deno.dev/update in their project folder. In other improvements in Fresh 1.4:

  • To simplify custom HTML, head, and body tags, developers can set the <html>, <head>, and <body> tag directly on the server.
  • Async layouts are supported, along with _layout components.
  • define* helper functions make function definitions quicker to type.
  • Route groups are featured to help with organizing code.

Future plans for Fresh include overhauling the plugin system to make it more powerful and easier to understand. Support for view transitions also is eyed, along with SPA-like client navigation.

Copyright © 2023 IDG Communications, Inc.



READ SOURCE

This website uses cookies. By continuing to use this site, you accept our use of cookies.