{"id":25717,"library":"haml-transpiler-server-loader","title":"haml-transpiler-server-loader","description":"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.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/Fire-Dragon-DoL/haml-transpiler-server-loader","tags":["javascript","haml","html","ruby","webpack","loader"],"install":[{"cmd":"npm install haml-transpiler-server-loader","lang":"bash","label":"npm"},{"cmd":"yarn add haml-transpiler-server-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add haml-transpiler-server-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Recommended to emit output HTML files; used in typical webpack config examples.","package":"file-loader","optional":true}],"imports":[{"note":"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.","wrong":"const loader = require('haml-transpiler-server-loader'); // Loader is not a programmatic export; use in webpack rules only","symbol":"loader","correct":"import 'haml-transpiler-server-loader'; // or use in webpack config as a string"},{"note":"Since v3, webpack recommends using the config object over query parameters.","wrong":"// Setting options via query string may conflict with webpack v2+ rules; prefer config object.","symbol":"hamlTranspilerServerLoader config","correct":"// In webpack config: module.exports = { //...  hamlTranspilerServerLoader: { ip: '127.0.0.1', port: 5487, moduleExport: true } }"},{"note":"Loader chains with file-loader emit separate HTML files; imports return the file path or module content depending on moduleExport.","wrong":"require('./template.html.haml'); // CommonJS style works but not recommended for ESM projects","symbol":"HAML file import","correct":"import template from './template.html.haml'; // With file-loader and this loader chained"}],"quickstart":{"code":"{\n  test: /\\.html\\.haml$/,\n  use: [\n    {\n      loader: 'file-loader',\n      options: { name: '[path][name].html' }\n    },\n    'haml-transpiler-server-loader'\n  ],\n  exclude: [/node_modules/]\n}","lang":"javascript","description":"Webpack rule that chains file-loader and haml-transpiler-server-loader to transpile .html.haml files into standalone HTML files."},"warnings":[{"fix":"Install Ruby, run 'gem install haml-transpiler-server', then start server with 'hamlts' before webpack","message":"Requires external Ruby haml-transpiler-server gem and running server process","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use webpack --watch or integrate with watchman for automatic rebuilds","message":"No built-in watching; file changes do not trigger re-transpilation unless webpack's watch mode is enabled","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure hamlts is running on default localhost:5487 or match custom configuration","message":"Connection errors if hamlts server not running or wrong IP/port","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'hamlts' in terminal before starting webpack, or configure loader with correct port","cause":"haml-transpiler-server not running or on different port","error":"Error: connect ECONNREFUSED 127.0.0.1:5487"},{"fix":"Run 'gem install haml-transpiler-server'","cause":"Ruby gem not installed","error":"Module build failed: Error: Could not find Ruby gem haml-transpiler-server"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}