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

liquify

v0.0.1

Published

Generates a liqify.js to provide Liquid templating in client-side javascript

Downloads

1

Readme

Liquify

Liquify is a Node.js module that creates a client-side version of the Liquid Templating language (see http://github.com/shopify/liquid) for use with JavaScript in the browser, available as both plain JavaScript (public/javascripts/liquify.js) and as minified JavaScript (public/javascripts/liquify.min.js).

This library is a client-side version of Marcel Jackwerth's liquid-node, which is a port of Tobias Lutke's Liquid templating language, originally implemented in Ruby.

Note: This is currently the result of a 3-day weekend project, so let me know if you find it useful or would like to suggest changes!

Usage

Client-Side

You may simply use the liquify.js/liquify.min.js files in your applications without using the npm module at all.

Reference liquify.js in your page, and start using it!

<html>
  <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Client-Side Liquid Templates</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	
	  <script type="text/javascript" src="./javascripts/liquify.min.js"></script>
    <script type="text/javascript">
    	var Liquid = require('liquify');
    </script>
  </head>

  <body>
    <script id="simplewithfilter" type="text/liquid">
      <div>Here is the value of foobar in uppercase: <strong>{{ foobar | upcase }}</strong></div>
    </script>
	
	  <script id="ifblock" type="text/liquid">
	    <div>
	      Trying out the if block.  If it works, you should see "Hooray!":&nbsp;
	      {% if cheer %}
	      Hooray!
	      {% else %}
	      Boo!
	      {% endif %}
	    </div>
	  </script>

    <script type="text/javascript">
      $(function() {
        $('body').append(Liquid.Template.parse($('script#simplewithfilter').html()).render({ foobar: 'bizbuzz'}));
	      $('body').append(Liquid.Template.parse($('script#ifblock').html()).render({{ cheer: true }}));
      });
    </script>
  </body>
</html>

Results in the following html page:

Here is the value of foobar in uppercase: BIZBUZZ

Trying out the if block. If it works, you should see "Hooray!": Hooray!

Server-Side

You may update your liquify.js files to the latest version of liquid-node's capabilities by simply installing the package from NPM:

$ npm install liquify

Or by installing the latest node package from git directly:

$ npm install [email protected]/tchype/node-liquify

You can see it working by running the sample page that uses liquify to render it's markup:

$ node ./node_modules/liquify/app.js
Server running at http://127.0.0.1:8125/
$ open http://127.0.0.1:8125

Acknowledgements

I have to take a minute to recognize the efforts of others.

The huge, gigantic THANK YOU has to go to sirlantis (Marcel Jekwerth) for even taking on the task of porting Liquid into node. Without his work on this front, I probably would have given up trying to implement it in purely client-side JavaScript at some point. Instead, his previous efforts and eagerness to accept pull requests and ideas for liquid-node have made it simply a 3 day weekend project to get something working!

Also, a big thank you goes out to substack for browserify as well as the overall contributions to node and Open Source. Thanks!

Finally, the biggest thank you (as well as an "I'm sorry for keeping my nose in the computer all weekend") has to go to my lovely wife and my silly, wonderful boys. Thanks for being patient with me!!