npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blaze-renderer

v0.9.0

Published

We render blaze templates for you... so Meteor doesn't have to!

Downloads

27

Readme

Blaze Renderer

We render blaze templates for you... so Meteor doesn't have to!

Circle CI

Render blaze to html without loading Meteor context/dependencies

Why would you want to do so?

Two reasons:

  1. server-side rendering
  2. testability

With this package you are able to use wallabyjs with jest snapshots to test blaze templates. The idea of Meteor internal testing was good, but it got left behind the great tools that the community brought.

Waiting for the Meteor to startup to run your tests is painful once you get used to the TDD immediate feedback loop that's possible in modern nodejs projects.

Look at this to understand what I'm talking about:

demonstration

Examples

Please take a look at tests/template.test.js with coresponding files put inside imports/client/lib to see the usage. To show a simle example:

<template name="passDataToTemplate">
    {{#with dataSource}}
        <div>
            should display "some value" below
            {{> templateToPassDataTo key.value}}
        </div>
    {{/with}}
</template>

<template name="templateToPassDataTo">
    should displayed passed argument:
    this directly - {{this}}
    this through helper - {{displayHelper this}}
</template>
Template.passDataToTemplate.helpers({
  dataSource: () => ({key: {value: "some value"}})
});
Template.templateToPassDataTo.helpers({
  displayHelper: value => value
});

and then

import renderBlaze from 'blazeRenderer';
require('./passDataToTemplate')
const stringifiedHtml = renderBlaze('passDataToTemplate')

stringifiedHtml should end up being

<div>
    should display "some value" below
    should displayed passed argument:
    this directly - some value
    this through helper - some value
</div>

This is obviously great to use with jest snapshots like so:

it('template pass arguments properly', () => {
  require('./passDataToTemplate')
  expect(renderBlaze('passDataToTemplate')).toMatchSnapshot()
})

TODO

At this moment the blaze code is super messy, so once I get it to work, and have tests in place I will spend some time refactoring, and putting it in modules. Basically, remove the old Meteor way of doing everything-global, and get it to nicely organized import/export structure (similarly to what I've done with parts of minimongo here: https://github.com/lgandecki/modifyjs )