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

templatefy

v0.2.4

Published

A html template manager with js injection, angular supported

Downloads

41

Readme

Templatefy

Build Status Coverage Status GPA Status Commits Issues Open Issue Resolution

Version Node Downloads Slack Status License

Templatefy is a html template manager with js injection, angular supported.

NPM NPM GRID

Table of contents

Installation

Install with npm install templatefy --save.

CLI (Command line interface)

You can use Templatefy as command line tool, installing as global library with npm i -g templatefy and execute with the command templatefy. To show options type: templatefy --help or with flag -h.

Options

Usage: /usr/local/bin/node templatefy [options]

Options:
   -i, --input     Input html file or string raw template
   -o, --output    Output compiled JavaScript file template
   -s, --scope     Enable scope function to prevent collition declarations  [false]
   -e, --exports   Exports the template using commonjs module exports  [false]
   -r, --var       Store the template into a variable
   -g, --global    Store the template into a global property <global:property>
   -a, --angular   Enable Angular templateCache injection; for angular options use --angular-<option-name>  [false]
   -l, --linter    Enable Linter validation; for linter options use --linter-<option-name>  [false]
   -m, --minify    Enable HTML minification process; for log options use --minify-<option-name>  [false]
   -V, --log       Enable log output; for minify options use --log-<option-name>  [false]
   -v, --version   Print version and exit

Go top

Usage

This example shows how to pass through stdin a template obtaining the output to the stdout:

echo '<h1>Foo</h1>' | templatefy --var=example

# ouput
# var example = '<h1>Foo</h1>';

As you can see it's possible use any string passed into the templatefy stdin, another example using the command cat:

cat index.html | templatefy --exports

# ouput
# module.exports = '<h1>Foo</h1>';

If want parse a html file using the command arguments, you can define the file path using --input and --ouput to define the output result By default if you don't define --output it be will print the result in the promt stdout.

echo '<h1>Foo</h1>' > template.html

cat template.html | templatefy --exports
# or
templatefy --input=./template.html --exports
# or
templatefy --input="<h1>Foo</h1>" --exports

# ouput
# module.exports = '<h1>Foo</h1>';

cat template.html | templatefy --exports --ouput=./ouput.js

# contents of ouput.js
# module.exports = '<h1>Foo</h1>';

Note: You can copy any pice of code from above and paste in your terminal. Try it!.

Go top

API (Application Programming Interface)

Options

scope

Type: Boolean Default: false

Enable function clousure for prevent variable collisions.

exports

Type: Boolean Default: false

Enable commonjs module.exports.

global

Type: String Default: null

Global variable expose global:property.

var

Type: String Default: null

Local variable name.

angular

Type: Boolean Object Default: false

Enable angular templateCache injection.

angular.shim

Type: String Default: angular

Angular variable name or factory.

angular.module.name

Type: String Default: templatefy

Angular templatefy module name.

angular.module.var

Type: String Default: templatefy

Angular templatefy module variable name.

angular.module.name

Type: String Default: templatefy

Angular templatefy module name.

angular.module.deps

Type: Array String Default: null

Angular templatefy module dependencies.

angular.module.run.args

Type: Array String Default: null

Angular templatefy module run dependencies.

angular.template

Type: Array String Default: null

Angular templatefy template name.

Go top

Usage

To use, add the require node module:


    const Templatefy = require('templatefy');

    Templatefy.parse('path/of/input-file.html', 'path/of/ouput-file.js');

Input (path/of/input-file.html)

    <h1><h2><h3>

Output (path/of/ouput-file.js)

    '<h1><h2><h3></h3></h2></h1>'

Go top

Live examples

Thanks to tonicdev.com you can test the bellow examples.

    const Templatefy = require("templatefy")

    Templatefy.parse({
        angular: true
    },'<h1>{{Title}}<h2>{{Subtitle}}', function(err, data){
          console.log(data);
    });

Try this snippet!! Go top

Documentation (WIP)

I'm working hard to develop the documentation a soon as possible, sorry for the inconvenience.

Go top

Contributing (WIP)

WIP

Go top

Community

Get updates on Templatefy's development and chat with the project maintainers and community members.

  • Follow me on @rubeniskov on Twitter to get updates.
  • Read and subscribe to The Official Templatefy Page (WIP).
  • Join the official Slack room.
  • Chat with fellow templatefiers in IRC. On the rubeniskov.irc.slack.com server, in the ##templatefy channel.
  • Developers should use the keyword templatefy on packages which modify or add to the functionality of Templatefy when distributing through npm or similar delivery mechanisms for maximum discoverability.

Go top

Creators

Rubén López Gómez [email protected]

Go top

Copyright and license

Code copyright 2016 Rubeniskov released under the MIT license.

Go top