1.2.1 • Published 1 year ago

rollup-plugin-archieml v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm size

rollup-plugin-archieml

A Rollup plugin which converts ArchieML files into JavaScript modules.

Install

npm install rollup-plugin-archieml --save-dev

Usage

Create a rollup.config.js configuration file and import the plugin:

import archieml from "rollup-plugin-archieml";

export default {
  input: "src/index.js",
  output: {
    dir: "output",
    format: "cjs",
  },
  plugins: [archieml()],
};

Then call rollup either via the CLI or the API.

Example

Given an ArchieML file called events.aml:

[+events]
  header: My Birthday
  date: August 20th, 1990

  Here's a nice photo

  {.image}
    src: http://example.com/photo.png
    alt: Family Photo
    [.members]
      * Dad
      * Mom
      * Me
    []
  {}
[]

Using this plugin, we can import (or require) the ArchieML file directly:

import events from "./events.aml";

console.dir(events, { depth: null });
// {
//   events: [
//     { type: 'header', value: 'My Birthday' },
//     { type: 'date', value: 'August 20th, 1990' },
//     { type: 'text', value: "Here's a nice photo" },
//     {
//       type: 'image',
//       value: {
//         src: 'http://example.com/photo.png',
//         alt: 'Family Photo',
//         members: [ 'Dad', 'Mom', 'Me' ]
//       }
//     }
//   ]
// }
1.2.1

1 year ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago