Registry / devops / haml-transpiler-server-loader

haml-transpiler-server-loader

JSON →
library4.0.0jsnpmunverified

Webpack loader that uses the Ruby-based haml-transpiler-server gem to transpile HAML files to HTML. Version 4.0.0 requires a separate Ruby server process (start via `hamlts`), communicating over TCP/IP. Unlike pure JavaScript HAML transpilers, this leverages the original Ruby implementation for correctness, at the cost of architectural complexity and an external dependency on Ruby and the gem. Configuration allows custom IP, port, and module export style. Suitable for projects already using Ruby HAML tooling.

npm install haml-transpiler-server-loader
INSTALL
IMPORT
SIG · HAML-TRANSPILER-SE
H
haml-transpiler-server-loader
devopsjavascriptv4.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

loader
import 'haml-transpiler-server-loader'; // or use in webpack config as a string
const loader = require('haml-transpiler-server-loader'); // Loader is not a programmatic export; use in webpack rules only
This package is a webpack loader, not a library. It is referenced by name in webpack config, not imported as a module in application code.
hamlTranspilerServerLoader config
// In webpack config: module.exports = { //... hamlTranspilerServerLoader: { ip: '127.0.0.1', port: 5487, moduleExport: true } }
// Setting options via query string may conflict with webpack v2+ rules; prefer config object.
Since v3, webpack recommends using the config object over query parameters.
HAML file import
import template from './template.html.haml'; // With file-loader and this loader chained
require('./template.html.haml'); // CommonJS style works but not recommended for ESM projects
Loader chains with file-loader emit separate HTML files; imports return the file path or module content depending on moduleExport.

Webpack rule that chains file-loader and haml-transpiler-server-loader to transpile .html.haml files into standalone HTML files.

{ test: /\.html\.haml$/, use: [ { loader: 'file-loader', options: { name: '[path][name].html' } }, 'haml-transpiler-server-loader' ], exclude: [/node_modules/] }
Debug
Known issues
breakingRequires external Ruby haml-transpiler-server gem and running server process
fix
Install Ruby, run 'gem install haml-transpiler-server', then start server with 'hamlts' before webpack
affects: >=0.0.0
gotchaNo built-in watching; file changes do not trigger re-transpilation unless webpack's watch mode is enabled
fix
Use webpack --watch or integrate with watchman for automatic rebuilds
affects: >=0.0.0
gotchaConnection errors if hamlts server not running or wrong IP/port
fix
Ensure hamlts is running on default localhost:5487 or match custom configuration
affects: >=0.0.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:5487
haml-transpiler-server not running or on different port
fix
Run 'hamlts' in terminal before starting webpack, or configure loader with correct port
Module build failed: Error: Could not find Ruby gem haml-transpiler-server
Ruby gem not installed
fix
Run 'gem install haml-transpiler-server'
Upgrade
Version history
4.0.0latest on npm
Audit
Dependencies
file-loaderoptionalRecommended to emit output HTML files; used in typical webpack config examples.
Agent activity
8 hits · last 30 days
node
8
Resources
haml-transpiler-server-loader — npm install haml-transpiler-server-loader · libregistry