longsword

0.1.1 • Public • Published

Longsword.js

About

The goal is to simplify partial page updates in projects where using a full front-end framework/library is overkill.

Right now there's not a lot of features and a lot of limitations, but I plan on updating when I can.

Limitations

  • There's no feature for looping (yet)
  • You must use flat objects (i.e. just a single value. no nested objects, no arrays, etc.)

These will be addressed shortly.

Installation

npm install longsword

Usage

Pretty simple right now:

  1. Create template in the form of a HMTL file
  2. Call longsword with three arguments: path to template, an object representing your data, and id of the element where the compiled template will be inserted.

Template syntax is pretty simple: <h1> Hello! My name is {name}</h1>

Template parser will expect the word between the braces to be a key in the data object you pass.

Example:

import longsword from 'longsword';

const data = {
    // data
}

longsword("path/to/template", data, "elementId");

Readme

Keywords

none

Package Sidebar

Install

npm i longsword

Weekly Downloads

3

Version

0.1.1

License

MIT

Unpacked Size

2.46 kB

Total Files

3

Last publish

Collaborators

  • oxideorcoal