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

boxcars

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boxcars

boxcars is a tiny collection library that comes with built-in caching for preloading contents.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-43.75%
Maintainers
1
Weekly downloads
 
Created
Source

boxcars is a tiny collection library that comes with built-in caching for preloading contents.

Install

$ npm install boxcars

Usage

var boxcars  = require('boxcars'),
    mustache = require('mustache');

var templates = boxcars();

templates('templates/foo.html', 'templates/bar.html', 'templates/quux.html', function(error, templates){
  if(error) throw error;

  console.log( templates[0] ); // will put the content of templates/foo.html

  // objects or arrays can be passed, as well
  templates({ 'corge': 'templates/corge.html', 'eggs': 'templates/eggs.html' }, function(error, moreTemplates){
    if(error) throw error;

    console.log( moreTemplates.corge );

  });

});

Preloading:

templates.cache({
  'quux.json': '{}',
  'templates/foo.html': '<strong>Hello {{ name }}!</strong>',
  'templates/bar.html': '<strong>Hello {{ name }}!</strong>'
});

Reset the cache:

templates.cache(undefined);

Testing

Publish the tests and visit localhost:1314 with the browser you want to test.

$ make publish-tests

To see the summary of the results;

$ make verify-tests

Keywords

FAQs

Package last updated on 10 Apr 2012

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