Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/damonsmith/bun-plugin-inline-templates


https://github.com/damonsmith/bun-plugin-inline-templates

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# Bun Plugin for HTML

The `bun-plugin-inline-templates` is a plugin for the Bun build tool that replaces any `` with the contents of the path in the href.

## Installation

You can install `bun-plugin-inline-templates` using the following command:

```bash
bun add -d bun-plugin-inline-templates
```

## Usage

To use this plugin, import it into your code and add it to the list of plugins when building your project with Bun. Here's an example:

```typescript
import inlineTemplates from 'bun-plugin-inline-templates';

await Bun.build({
entrypoints: ['./src/index.html', './src/other.html'],
outdir: './dist', // Specify the output directory
plugins: [
inlineTemplates()
],
});
```

Or if you're using it with bun-plugin-html then add it after that plugin like this:
```typescript
import html from 'bun-plugin-html';
import inlineTemplates from 'bun-plugin-inline-templates';

await Bun.build({
entrypoints: ['./src/index.html', './src/other.html'],
outdir: './dist', // Specify the output directory
plugins: [
html(),
inlineTemplates()
],
});
```

## Acknowledgements

This plugin was created by mostly copying the bun-plugin-html plugin from Bjorn at https://github.com/BjornTheProgrammer/bun-plugin-html

Massive thanks to that project, this plugin is designed to be inserted before it so that they can be used together.

## License

This plugin is licensed under MIT.