Brak opisu

Matheus Giovani 6807ee37d5 updated documentation 2 lat temu
examples 2fd15c8dc1 added support for comments to virtual-dom 2 lat temu
packages 6807ee37d5 updated documentation 2 lat temu
test 389f6daf28 added components 2 lat temu
.gitignore b508f2f301 fixes gitignore 2 lat temu
.gitmodules bfa4cc8e1f added virtual-dom submodule 2 lat temu
.npmignore 43d0b5515e fixes reactivity 2 lat temu
LICENSE d873f3a526 first commit 3 lat temu
README.md 9d912fd219 updated README documentation 2 lat temu
jest.config.js 57dbd2e0b8 general refactor 3 lat temu
nodemon.json 463c879255 fixes some minor bugs and adds new documentation 2 lat temu
package.json ec3855642f added build configuration 2 lat temu
tsconfig.json dd48e19f34 reformulated component declaration 2 lat temu
webpack.config.js 2fd15c8dc1 added support for comments to virtual-dom 2 lat temu

README.md

pupper.js icon

pupper.js

pupper.js is a reactive framework based in pugjs.

This is a BETA project, it can change drastically over time, so use it with caution for now and stay updated! :D


Basic syntax

pupper.js syntax is based in pugjs. You can learn about pugjs's syntax here.

Tags and attributes

//- <div class="classname" data-id="1"></div>
.classname(data-id="1")

//- <div id="id" class="class"></div>
#id.class

//- <span class="with-class" id="and-id"></span>
span.with-class#and-id

//- pupper already know if an element tag can be auto-closed
//- <input name="test />
input(name="test")

Conditional

if conditional
    |This will be shown if `conditional` is met
else
    |This will be shown if `conditional` is not met

Iteration

each item in items
    //- Will render the item name for each item
    =item.name

How to use

You can integrate pupper.js to your application by using one of the given loaders that compiles .pupper files into Javascript:


template.pupper

template
    .test
        span.hello-world(id=id)
            =content

data
    id="the-id"
    content="Hello, beautiful world!"

index.js

const template = require("./template.pupper");

const app = document.createElement("div");
document.body.appendChild(app);

/**
 * Will append the following inside the "app" container:
 * 
 * <div class="test">
 *      <span class="hello-world" id="the-id">
 *          Hello, beautiful world!
 *      </span>
 * </div> 
 */
template.mount(app);