Plugins Overview
Ecopages provides two main types of plugins to extend its functionality:
- Processors: Handle file transformations and asset processing
- Integrations: Add support for new templating engines or frameworks
Types of Plugins
Processors
Processors are plugins that handle file transformations. They can:
- Transform files during build time
- Generate additional assets
- Optimize content
- Provide Bun loaders for development
Examples include the PostCSS processor and Image processor.
Integrations
Integrations add support for different templating engines and frameworks. They:
- Define file extensions to handle
- Provide rendering logic
- Manage dependencies
- Handle asset inclusion
Examples include the KitaJS, React, and Lit integrations.
Plugin Configuration
Plugins are configured in your eco.config.ts
file:
import { ConfigBuilder } from '@ecopages/core';
import { postcssProcessorPlugin } from '@ecopages/postcss-processor';
import { kitaPlugin } from '@ecopages/kitajs';
const config = await new ConfigBuilder()
.setProcessors([
postcssProcessorPlugin(),
])
.setIntegrations([
kitaPlugin(),
])
.build();
See Custom Processor and Custom Integration for details on creating your own plugins.