Eustia Component Transpiler
raw JSON → 0.0.3 verified Fri May 01 auth: no javascript
A transpiler plugin for the Eustia build tool that converts HTML files containing inline styles, templates, and scripts into pure JavaScript modules. Version 0.0.3 is the latest release. It is designed for use with Eustia to simplify authoring reusable UI components with HTML and CSS, without relying on web components. The transpiler extracts CSS into a string variable, HTML templates into string variables, and concatenates script content, providing a simple component pattern for library authors.
Common errors
error Error: Cannot find module 'eustia-component' ↓
cause Package not installed or missing in node_modules.
fix
Run 'npm install eustia-component'
error TypeError: handler is not a function ↓
cause Using require('eustia-component') instead of require('eustia-component')().
fix
Change handler: require('eustia-component') to handler: require('eustia-component')()
Warnings
deprecated Package is very low version and rarely updated; may not be maintained for future Eustia versions. ↓
fix Consider using modern component frameworks like Vue or React if Eustia support is discontinued.
gotcha The exported function must be called with no arguments to get the transpiler handler; directly using require('eustia-component') as handler will fail. ↓
fix Use handler: require('eustia-component')()
gotcha The plugin only works within the Eustia build system; it is not a standalone HTML-to-JS converter. ↓
fix Ensure Eustia is properly configured in your project.
Install
npm install eustia-component yarn add eustia-component pnpm add eustia-component Imports
- eustia-component wrong
const eustiaComponent = require('eustia-component')()correctconst eustiaComponent = require('eustia-component') - handler wrong
handler: require('eustia-component')correcthandler: require('eustia-component')() - EustiaComponent wrong
import { eustiaComponent } from 'eustia-component'correctimport eustiaComponent from 'eustia-component'
Quickstart
// eustia.config.js
module.exports = {
util: {
files: 'index.html',
extension: ['js', 'html'],
transpiler: [
{
test: /\.html$/,
handler: require('eustia-component')()
}
]
}
};