# moon-component-compiler

> Compiler for Moon Single File Components

Latest version **0.1.4** (published 2017-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install moon-component-compiler
pnpm add moon-component-compiler
yarn add moon-component-compiler
bun add moon-component-compiler
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2017-08-09 |
| First published | 2017-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kabir Shah |
| Maintainers | kingkabir |
| Keywords | compiler, moon, single, file, components, components, component |

## Links

- npm: https://www.npmjs.com/package/moon-component-compiler
- Repository: https://github.com/kbrsh/moon-component-compiler
- Homepage: https://github.com/kbrsh/moon-component-compiler#readme
- Issues: https://github.com/kbrsh/moon-component-compiler/issues
- npm.io page: https://npm.io/package/moon-component-compiler

## Dependencies (1)

- [himalaya](https://npm.io/package/himalaya.md) ^0.2.8

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 0.1.4 (latest) — 2017-08-09
- 0.1.3 — 2017-08-09
- 0.1.1 — 2017-08-03
- 0.1.0 — 2017-08-02
- 0.0.5 — 2017-08-02
- 0.0.4 — 2017-07-10
- 0.0.3 — 2017-07-08
- 0.0.2 — 2017-05-28
- 0.0.1 — 2017-05-27

## README

# Moon Component Compiler

Compiler for Moon Single File Components

### Single File Components

Single file components are a way to declare Moon components. Each can have a top level `template`, `style`, and `script` tag.

For example:

```html
<template>
  <div>
    <h1>Component!</h1>
    <p>{{someProp}}</p>
  </div>
</template>

<style lang="stylus" scoped>
h1
  color blue
</style>

<script>
exports = {
  props: ['someProp']
}
</script>
```

As you can see, you can have scoped CSS, preprocessors, and organize your code!

### Compiling

To compile a single file component (a `.moon`file), you can do:

```js
const compile = require("moon-component-compiler");
const compiled = compile("Head", component, {
  hotReload: true
});
```

The result will be an object containing:

* The Moon component, exported through `module.exports`;
* The styles extracted from the component

For example:

```js
{
  component: "",
  style: ""
}
```

### License

Licensed under the [MIT License](https://kbrsh.github.io/license) by [Kabir Shah](https://kabir.ml)

---
_Source: https://npm.io/package/moon-component-compiler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
