Git Product home page Git Product logo

arc-plugin-marko's Introduction

arc-plugin-marko

A plugin for using Marko with architect.

Installation

This plugin contains both build-time code and runtime code, you will need to install it in the root of your architect project as well as each architect route that will be serving Marko templates:

npm install arc-plugin-marko --save

Usage

marko-architect-todomvc is a fully functioning sample app using this plugin.

Inside the .arc file inside your project, you will need to specify the pages property, which are the absolute paths to the pages that will be served, and the bucket property, which a globally unique AWS S3 bucket.

.arc

...
@plugins
arc-plugin-marko
  pages ./src/html/get-index/page.marko
  bucket marko-todomvc-bucket

Then you need to register the runtime code for each page that should be rendered:

src/html/get-index/index.js

exports.handler = require('arc-plugin-marko/runtime').run({
  template: require('./page')
})

Example of a top-level page:

src/html/get-index/page.marko

<!doctype html>
<html>
  <head>
    <title>Marko + Arc = <3</title>
  </head>
  <body>
    <my-fancy-button/>
  </body>
</html>

Plugin API Configuration

Supported properties that can be passed to the plugin:

  • {Object} options.pages - [Required] Absolute path to all Marko top-level pages to render
  • {String} options.bucket - Globally unique AWS S3 bucket name
  • {Object} options.config - Custom Lasso configuration

Plugin Runtime API

API for require('arc-plugin-marko/runtime')

  • run(options)
    • {Object} options.template - [Required] template module to render
    • {Object} options.buildConfig - Custom Lasso configuration
    • {Object} options.data - Data that will be passed to the Marko template
    • {Function} options.onDone - Callback function to call when the Marko template has finished rendering
    • {Function} options.onError - Callback function to call if the Marko template render failed with an error

arc-plugin-marko's People

Contributors

austinkelleher avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

smulder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.