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.

  • 1.1.61
  • 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.

Usage without NPM

<!DOCTYPE html>
<html>
 <head>
   <title>Literal JS Test</title>
   <script src="http://unpkg.com/literaljs"></script>
 </head>
 <body>
   <div id="app"></div>
   <script>
     var firstComponent = Literal.Component(
       `<div>
         This should render.
         <p>Isn't this lovely?</p>
         ${secondComponent}
       </div>`
     );

     var secondComponent = Literal.Component(
       `<div>
         Oh yeah!
       </div>`
     );

     Literal.Render(firstComponent, 'app');
   </script>
 </body>
</html>

Example

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

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

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

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

The Render method takes the main parent component of your app and id of DOM node you want to attach the markup to.

FAQs

Package last updated on 31 Jan 2018

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