All Projects → i5ik → bepis

i5ik / bepis

Licence: other
🐕 bepis - Write components concisely. Like to play? https://cutt.ly/bepis?drincc!

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to bepis

Aris
Aris - A fast and powerful tool to write HTML in JS easily. Includes syntax highlighting, templates, SVG, CSS autofixing, debugger support and more...
Stars: ✭ 61 (+24.49%)
Mutual labels:  js-framework
xijs
A business - oriented scene Js Library
Stars: ✭ 91 (+85.71%)
Mutual labels:  js-framework
alga-js
Alga.js is javascript helper for helping build a component of any front-end web frameworks
Stars: ✭ 18 (-63.27%)
Mutual labels:  js-framework
Minirefresh
优雅的H5 下拉刷新。零依赖,高性能,多主题,易拓展。(A Graceful HTML5 Drop-Down-Refresh Plugin. )
Stars: ✭ 1,525 (+3012.24%)
Mutual labels:  js-framework
Mescroll
精致的下拉刷新和上拉加载 js框架.支持vue,完美运行于移动端和主流PC浏览器 (JS framework for pull-refresh and pull-up-loading)
Stars: ✭ 3,775 (+7604.08%)
Mutual labels:  js-framework

Bepis Logo

🐕 bepis download badge version badge

Dynamic HTML + CSS in JavaScript. Implemented using a custom parser for a new HTML templating DSL.

It Is On Npm

npm i bepis

Examples

Simple keyed list, play with it here:

First, import:

import { w, clone } from "bepis";

Then set up some data:

const myItems = [
  { name: "Screw", description: "Part", key: "a3" },
  { name: "Moxie", description: "Intangible", key: "x5" },
  { name: "Sand", description: "Material", key: "p4" },
];
const newName = "Mojo";

Make some views:

const KeyedItem = item =>
  w` ${item.key} 
    li p, 
      :text ${item.description}.
      a ${{ href: item.url }} :text ${item.name}..`;

const SingletonList = items =>
  w` ${true} 
    ul :map ${items} ${KeyedItem}`;

Render the data and mount the view to the document

SingletonList(myItems)(document.body);

Make a change and see it

const myChangedItems = clone(myItems);
myChangedItems[1].name = newName;

setTimeout(() => SingletonList(myChangedItems), 2000);

:text, :map and :comp directives.

  • Use :text to insert text, and :map to insert lists, as in the above example.
  • Use :comp to insert components:
    w`
      main,
        h1 ${"Demo"}.
        :comp ${myChangedItems} ${SingletonList}..`

Basics

  • Use template literals tagged with w. This creates a 'bepis'
  • Use ',' operator to save an insertion point
  • Use '.' operator to load an insertion point
  • <tag name> ${attributes} ${styles} is the format.
  • Whitespace is ignored.

Up next

  • minimal diffing with updator functions.

Related Projects

I don't know. I didn't search any "prior art." Let me know how I reinvented this beautiful wheel by opening a PR request.


Bepis Wants You

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].