# vixeny-prespective

> Engine views for Vixeny

Latest version **0.1.20** (published 2024-05-31) · ISC license · 0 weekly downloads

## Install

```sh
npm install vixeny-prespective
pnpm add vixeny-prespective
yarn add vixeny-prespective
bun add vixeny-prespective
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.20 |
| Published | 2024-05-31 |
| First published | 2024-02-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 199 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | mimimonads |

## Links

- npm: https://www.npmjs.com/package/vixeny-prespective
- Repository: https://github.com/mimiMonads/vixeny-prespective
- Homepage: https://github.com/mimiMonads/vixeny-prespective#readme
- Issues: https://github.com/mimiMonads/vixeny-prespective/issues
- npm.io page: https://npm.io/package/vixeny-prespective

## Dependencies (3)

- [vixeny](https://npm.io/package/vixeny.md) ^0.1.10
- [@types/ejs](https://npm.io/package/@types/ejs.md) ^3.1.5
- [@types/pug](https://npm.io/package/@types/pug.md) ^2.0.10

## Recent versions

- 0.1.20 (latest) — 2024-05-31
- 0.1.12 — 2024-03-02
- 0.1.11 — 2024-02-29
- 0.1.0 — 2024-02-26
- 0.0.99 — 2024-02-26
- 0.0.986 — 2024-02-21
- 0.0.985 — 2024-02-21
- 0.0.982 — 2024-02-20
- 0.0.981 — 2024-02-18
- 0.0.98 — 2024-02-18
- 0.0.97 — 2024-02-16
- 0.0.95 — 2024-02-15
- 0.0.9 — 2024-02-15
- 0.0.8 — 2024-02-15
- 0.0.6 — 2024-02-13
- … 5 more at https://npm.io/package/vixeny-prespective/versions

## README

# vixeny-prespective

The `vixeny-prespective` is a plugin for the Vixeny library, designed to extend
its capabilities with template rendering. This plugin allows applications using
Vixeny to compile, render, and manage templates easily, providing a seamless
integration for web applications to generate dynamic HTML content.

# Pug

## Installation

To use `vixeny-prespective` in your project, first, ensure that you have Vixeny.
Then, install `vixeny-prespective` via npm:

```bash
npm install vixeny-prespective
```

It comes with:

- compileFile as composeCompiledFile
- compile as composeCompiled
- compileClient as composecompiledClient
- compileFileClient as composeCompiledFileClient,
- render as render,
- renderFile as renderFile

## Usage

After installing, you can import and use `vixeny-prespective` in your Vixeny
application to utilize Pug templates. Here is a basic example of setting up your
application with the plugin:

Please add a folder: `src/pug` with the name `template.pug` with:

```pug
p #{name}'s Pug source code!
```

```typescript
import { vixeny, wrap } from "vixeny";
import { pug, staticServerPlugings } from "vixeny-prespective"; // Importing the plugin options

// Modify your helpers.ts to include pugOptions
const pugOptions = {
  cyclePlugin: {
    compileFile: pug.compileFile,
    compile: pug.compile,
    compileClient: pug.compileClient,
    compileFileClient: pug.compileFileClient,
    render: pug.render,
    renderFile: pug.renderFile,
  },
};

const routes = wrap(pugOptions)()
  .stdPetition({
    path: "/compileFile",
    headings: {
      headers: ".html",
    },
    plugins: {
      compileFile: {
        path: "./src/pug/template.pug",
      },
    },
    f: (c) => c.compileFile({ name: "helloworld" }),
  })
  .stdPetition({
    path: "/compile",
    headings: {
      headers: ".html",
    },
    plugins: {
      compile: {
        source: `p #{name}'s Pug source code!`,
      },
    },
    f: (c) => c.compile({ name: "helloworld" }),
  })
  .stdPetition({
    path: "/compileClient",
    plugins: {
      compileClient: {
        source: `p #{name}'s Pug source code!`,
      },
    },
    f: (c) => c.compileClient,
  })
  .stdPetition({
    path: "/compileFileClient",
    plugins: {
      compileFileClient: {
        path: "./src/pug/template.pug",
      },
    },
    f: (c) => c.compileFileClient,
  })
  .stdPetition({
    headings: {
      headers: ".html",
    },
    path: "/render",
    f: (c) => c.render(`p #{name}'s Pug source code!`),
  })
  .stdPetition({
    headings: {
      headers: ".html",
    },
    path: "/renderFile",
    f: (c) => c.renderFile("./src/pug/template.pug"),
  });

// Example of setting up a Vixeny app with Pug template rendering in Bun in http://localhost:3000/
Bun.serve({
  fetch: vixeny(pugOptions)([
    ...routes.unwrap(),
    //with static server
    {
      type: "fileServer",
      name: "/",
      path: "./public/",
      //it has options
      template: staticServerPlugings.pug(),
    },
  ]),
});
```

## Features

- **Compile Pug Templates**: Convert Pug templates into HTML strings
  server-side.
- **Render Pug Files**: Directly render Pug files into HTML, supporting dynamic
  content.
- **Compile for Client**: Prepare Pug templates for client-side use, allowing
  templates to be used directly in the browser.
- **Comprehensive Pug Support**: Utilizes the full power of Pug for dynamic
  template rendering within the Vixeny framework.

## Testing

`vixeny-prespective` comes with a set of tests to ensure functionality. Refer to
the provided test file examples to write and run tests for your applications
using the plugin.

## Contributing

Contributions to `vixeny-prespective` are welcome. Please follow the standard
pull request process, and ensure all tests pass before submitting your
contribution.

---
_Source: https://npm.io/package/vixeny-prespective · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
