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

grunt-mustache

v0.3.0

Published

A grunt plugin to concatinate mustache template files

Downloads

47

Readme

grunt-mustache

Retire Status Build Status Dependency Status NPM version

A grunt plugin to concatinate mustache template files into a valid JavaScript syntax file.

This plugin does NOT bake JSON data with mustache templates. This plugin is created to handle the template baking with mustache/handlebars within a web projects internal JavaScript methods.

No more development

I will no longer develop this plugin any further and I strongly suggest users of this plugin to either fork it and continue the development on their hand, or find another plugin.

Getting Started

Install this grunt plugin next to your project's Gruntfile.js with:

npm install grunt-mustache

Then add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-mustache');

Documentation

Add something like this in your gruntfile:

mustache: {
  files : {
    src: 'src/main/webapp/js/mustache/',
    dest: 'src/main/webapp/js/src/templates.js',
    options: {
      prefix: 'my.templates = ',
      postfix: ';',
      verbose: true
    }
  }
}

Note: If postfix/prefix options are set or not, you can either create a JS object;

my.templates = {"templatename": 'template-data' [...], "done": "true"};

or a JSON-ish-string:

({"templatename": 'template-data' [...], "done", "true"})

The parenthesis are there to produce a valid JavaScript file. In the future we might change this to write a JSON file if no pre/post-fix is set.

Options

prefix

  • Type: String
  • Defaults: (

String to prepend the generated string. Defaults to ( to give a valid JavaScript string.

postfix

  • Type: String
  • Defaults: )

String to append the generated string. Defaults to ) to give a valid JavaScript string.

verbose

  • Type: Boolean
  • Defaults: false

Toggle for verbose output.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

(Until v1.0.0, this will only be updated when major or breaking changes are made)

10/01/2013: Added support for grunt v 0.4.0rc5

01/01/2013: Pull request merged for some linting fixes and updates for readme

30/12/2012: Minor tweaks: removed requirement for postfix/prefix option, trailing whitespace cleanup, updated docs (nilsel)

21/12/2012: Upgraded task to fit grunt v 0.4*, renamed old gruntfile and added postfix/prefix support for template generation. removed old config.varname functionality

19/12/2012: Edited script for newer grunt-version (didn't get it to work quite right, replaced helper with callback, added some options for variable name + minor stuff)

License

Copyright (c) 2012 Alexander Vassbotn Røyne-Helgesen
Licensed under the GPL license.