A web framework that compiles straight to lazy loaded HTML, CSS and JS with near-zero runtime overhead.
I am to make all reactivity compiled so that there is minimal runtime overhead.
<script compiled>
$ count = 0;
</script>
<h1>{{ $count }}</h1>
<button @click="$count = $count + 1">Increment</button>
<button @click="$count = $count - 1">Decrement</button>Install the 2web cli.
$ npm install -g @two-web/cli
>Generate a new 2web project.
$ 2web new <project_name>
>The 2Web compiler can optimize existing HTML, JavaScript/TypeScript, and CSS/SCSS/SASS code while also providing a "fixed" syntax of HTML.
- The compiler can recognize that a resource is not on the hot-path, and will lazy load the resource.
- The compiler can identify dynamic parts of the page and automatically apply
containsandwill-changeoptimizations. - (TODO) Automatically create pages for dynamic routes using the
[param_name]file name syntax.
- First-class TypeScript support in
<script>tags - (TODO) First-class SASS/SCSS support in
<style>and<link>tags - (TODO) All elements can now self-close (e.g.
<script src="my-script.ts" />) - (TODO) You can escape HTML tokens (e.g.
<) by using back slashes (e.g./<will display a<character). - Tags inside of
<code>blocks no longer need to use HTML escape codes. - You can import
.htmlfiles as components. - New JavaScript reactive variable declaration syntax using
$keyword. - Create web pages without HTML boilerplate
- Create web pages using Markdown
The 2Web kit is a package containing framework agnostic helpers to build fast and robust web applications.
Provides a standardized (opinionated) way to set up a project.
The CLI also contains a lot of templates and generators that can be used to easily add functionality such as SSR, database, load balancers, etc... to your application with one command.
A vscode extension to integrate with the 2web cli.
2Web comes with a built-in MCP server that can be used to directly connect LLMs and code editors to your 2Web project for AI-enhanced development.
2Web is not intended to be a complete solution for web development, and is instead supposed to patch quirks.
You should consider using the following libraries with 2Web.