rollup-plugin-archieml
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

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' ]
//       }
//     }
//   ]
// }

Readme

Keywords

Package Sidebar

Install

npm i rollup-plugin-archieml

Weekly Downloads

163

Version

1.2.1

License

MIT

Unpacked Size

6.83 kB

Total Files

6

Last publish

Collaborators

  • plmrry