0.1.0 • Published 1 year ago
samsun-plugin-html v0.1.0
samsun-plugin-html
This is a plugin for Samsun, a Fast Backend server framework. The purpose of this plugin is to handle HTML files within your Samsun project.
Installation
Install the plugin using your preferred package manager:
$ npm install samsun-plugin-html
or
$ yarn add samsun-plugin-html
Usage
Importing the plugin
import html from "samsun-plugin-html";
Configuring the plugin
The html
function provided by the plugin accepts an options object with the following properties:
dir
: The directory where your HTML files are located. Defaults to "app".route
: Whether to enable routing for HTML files. Defaults to true. (Not a string, use RegEx)
Example
import { defineConfig } from "samsun";
import html from "samsun-plugin-html";
export default defineConfig({
// other configurations...
plugins: [html()],
});
Transforming HTML files
The plugin will transform your HTML files into the content of the file. If the file does not exist, an error message will be returned.
Example:
index.js
:
export default function () {
return "index.html";
}
app/index.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
Hello World!
</body>
</html>
License
0.1.0
1 year ago