0.3.0 • Published 2 years ago

@macaron-elements/compiler v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

The Macaron compiler library and command-line interface

This library / CLI is the compiler that converts Macaron files to Web Components.

Installation

npm install -g @macaron-elements/compiler

Usage

# compile to src/*.js
macaron src/*.macaron

# compile to src/*.js and watches for changes
macaron --watch src/*.macaron

# compile to dist/*.js
macaron --output=dist src/*.macaron
macaron [options] <file paths or glob pattern>
OptionDescription
--watchWatch for changes and re-generate the component.
-o, --outputOutput directory. Defaults to the parent directory of the input

Help

macaron help

API

import { compile } from "@macaron-elements/compiler";

const data = fs.readFileSync("src/test.macaron", "utf-8");
const out = compile(data);
fs.writeFileSync("src/test.js", out);