Aucune description

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

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);