HTML Generator utilizes the Laravel Blade template engine to help PHP developers quickly generate HTML for web application frontends. It leverages Blade's powerful features to speed up frontend development.
Clone the repository to your local machine:
git clone git@github.com:binjuhor/html-generator.gitRun the following commands to quick install the dependencies and set up the project:
yarn setupPut your local domain to the .env file:
APP_URL=http://localhost:8000yarn devyarn buildYou just need to add &build to the URL to compile the HTML Generator. And the HTML files will be generated in the compiles directory.
To run the application, use the following command:
yarn serveNote: tested on MacOS and Ubuntu.
yarn exportThen in the root directory, you will find the compiles.zip file. Extract the file to your server and run the application.
Note: Just need to run yarn export to compile the HTML Generator and export the compiles.zip file, no need to add &build to the URL to compile the HTML Generator.
Create new templates in the resources/views/templates directory. Use the resources/views/layouts/app.blade.php layout file to extend the layout for your templates.
Put your HTML content to @section('content') in your template file.
@extends('layouts.app')
@section('content')
<h1>Hello, world!</h1>
@endsectionYou can also use the @include directive to include partials in your templates.
@extends('layouts.app')
@section('content')
@include('partials._form')
@endsectionYou can use f request parameter to switch between different views. For example, if you have a view called home.blade.php and you want to switch to about.blade.php, you can do so by adding ?f=about to the url.
Note: You need to change $domain in .env to your domain localhost or website URL to avoid errors when generate HTML files.
- Create a new template like Laravel blade
- Use components in the template
- Use slots in the template
- Use directives in the template
- Generate HTML from the template
Email: hi@binjuhor.com