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

goat-node

v0.0.5

Published

Simple view engine for Express

Downloads

10

Readme

goat-node

###Another Express view engine

Push get, post variables into $_GET, $_POST - coming soon..

$ npm install html-node

(GOAT == 'Greatest of All Time') ? 'No..'

We were feeding goats at the petting zoo, and I thought about feeding data to an HTML template.

First of all, some reasons why another view/templating engine was worth a short time to put together.

Frankly, it gets no better than,

Hello <?=$name?>, how are you..  

(I don't use because unlike some people I don't like to type)

NO template engine to reference or load, by the way..

Almost all view engines are that, except with a new strange syntax to learn.

Now,

  1. Jade is good. Very nice. Terse == lovely. I wasn't crazy about having to learn it (Markdown either, as you can tell by the (!lovelyness) of my README),

After some practice I can sort-of get stuff done. BUT I use two environments, Nodejs and PHP v5.2. Jade for PHP v5.3> only, so says Mr. Google. :(
I'm not upgrading my PHP right now.

Need something more old-school compatible.

  1. Templates for every template engine I could find are not valid HTML. (Except Plates I believe) Something just icky about that. I want to match on Div ids ala Plates. But I want something very low on features. Small simple modules, pieced together. (Plus I want to get the 1st version out in 1 day)

  2. Logic in the template, programming constructs, just feels rigid and wrong.

  3. Custom syntaxes is more stuff to learn. I don't really need that. Only two things to know with feeding data to these templates.

Expressjs styley..

res.render('index', {name:'Goat'}

// this is index.html: // you can guess what happens..

// need to handle arrays too

res.render('index', {name:'Goat', people:[{name:'chris', age:42}, {name:'paris', age:32}]}

		<div id='name'></div>
        <table id="">
            <tr>
                <th>name</th><th>age</th>
            </tr>
            <tr id="people">
                <td id="name"></td>
                <td id="age"></td>
            </tr>
        </table>
var render = require('php-node')({bin:"c://php//php.exe"});

render(__dirname+'/index.php', {}, function(e, r) {
    console.log(r);
})

// use PHP as view engine in Express
var express = require('express'),
	app = express(),
	phpnode = require('php-node')({bin:"c:\\php\\php.exe"});

app.set('views', __dirname);
app.engine('php', phpnode);
app.set('view engine', 'php');

app.all('/index.php', function(req, res) {
   res.render('index');
})

var port = process.env.PORT || 3000;
app.listen(port, function() {
  console.log("Listening on " + port);
})