Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bepis

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bepis

bepis is a crazy new way to write HTML + CSS in JavaScript

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Bepis Logo

:dog2: bepis download badge version badge

Dynamic HTML + CSS in JavaScript.

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.

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

Keywords

FAQs

Package last updated on 26 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc