C# to JavaScript compiler

# Installation

To get started with h5, you need to install the compiler and the project template. h5 is built as a dotnet global tool, making it easy to integrate into your workflow.

# 1. Install the Compiler

The h5 compiler is distributed as a dotnet tool. You can install it globally on your machine using the following command:

dotnet tool install -g h5-compiler

To update the compiler to the latest version, use:

dotnet tool update -g h5-compiler

# 2. Install the Project Template

h5 provides a dotnet new template to help you quickly set up a new project. Install the template using:

dotnet new install h5.Template

# 3. Create a New Project

Once the template is installed, you can create a new h5 project using the dotnet new command:

dotnet new h5 -n MyWebProject

This will create a new directory named MyWebProject with a basic h5 application structure, including:

  • A .csproj file configured for h5.
  • An h5.json configuration file.
  • A sample App.cs file.
  • An index.html file to run your application.

# 4. Build and Run

Navigate to your project directory and build the project:

cd MyWebProject
dotnet build

After building, the compiled JavaScript files will be output to the bin/Debug/netstandard2.1/h5/ directory (or wherever your output path is configured).

To run your application, you can use a simple static file server. For example, using dotnet-serve:

dotnet tool install -g dotnet-serve
dotnet serve ./bin/Debug/netstandard2.1/h5/

Open your browser and navigate to the provided URL (usually http://localhost:8080) to see your h5 application running.