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

literaljs

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

literaljs

Lightweight components using template literals with a virtual dom and diff system.

  • 1.0.5
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-14.29%
Maintainers
1
Weekly downloads
 
Created
Source

LiteralJS

Is a simple view library for creating components with Template Literals. Components are converted to Hyper Script which creates the virtual dom. The virtual dom has a diffing mechanism similar to ReactJS. This library is still in Alpha.

Usage without NPM

<!DOCTYPE html>
<html>
 <head>
   <title>Literal JS Test</title>
   <script src="https://unpkg.com/literaljs"></script>
   <script src="index.js"></script>
 </head>
 <body>
   <div id="app"></div>
 </body>
</html>

Example

Component
Literal.Component(
  `<p class="corn">
    <div>
      This is a div!
    </div>
  </p>`
);

Components just accept Template Literals and generate Hyper Script. You can combine components with ${ }, like this:

var firstComponent = Literal.Component(
  `<div>
      This should render like React.
      <p>Isn't this lovely?</p>
      ${otherComponent}
  </div>`
);

var secondComponent = Literal.Component(
  `<div>
      Oh yeah!
    </div>`
  );
Render
Literal.Render(MainComponent, 'app');

The Render method takes the last component and id of an html node in your entry file.

FAQs

Package last updated on 29 Oct 2017

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