npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vixeny-prespective

v0.1.20

Published

Engine views for Vixeny

Downloads

8

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:

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:

p #{name}'s Pug source code!
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.