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 🙏

© 2026 – Pkg Stats / Ryan Hefner

onlyjs

v0.0.3

Published

Allows HTML and CSS to be written neatly with Javascript object literals

Readme

only.js: Write everything in javascript

only.js allows HTML and CSS to be written inline in Javascript code using JSON representation.

For example, this HTML:

<div>
  <p>Food:</p>
  <ul class="cake">
    <li>Milk</li>
    <li>Spinach</li>
    <li>Tacos</li>
    <li>Peas</li>
  </ul>
</div>

can become this javascript:

only.setHtml([
  {div: [
    {ul: [
        {li: "Milk"},
        {li: "Spinach"},
        {li: "Tacos"},
        {li: "Peas"}
      ],
      class: "cake"
    }]//ul
  }//div
]);

###CSS This CSS:

.cake {
  color: red;
  display: inline-block;
}

becomes this javascript:

only.makeCss(".cake",{
  color: "red",
  display: "inline-block"
});

or, put css style inline with javascript

only.setHtml({
  p: "Hello World",
  css: {
    color: "red",
    display: "inline-block"
  }
})

###Inline javascript This allows you to put any code you want into your HTML representation directly, just like a templating engine but in Javascript:

only.setHtml([
    {p: String(new Date())}
]);

Will be displayed as:

###Keep all code for one component together This HTML+javascript+CSS, spread between three files:

<body>
  <!-- ... -->
  <button id="button1" class="button"></button>
  <!-- ... -->
</body>
//...
$(".button1").click(
	alert("I just got clicked!");
)
//...
/* ... */
.button {
	border-style: solid;
	border-width: 5px;
}
/* ... */

can become just one thing in one file:

//create button
var button = only.html(
  {button: "ima button",
		css: {
			borderStyle: "solid",
			borderWidth: "5px"
		}
	}
);

//add listener
button.addEventListener("click", function(e){
  console.log("button clicked!");
})

//add to page
only.setHtml([
  button
])

###Reuse Elements Easily To reuse an element, all you need to do is save it in a var:

//create reusable error message
var errorMsg = {
	div: [
		{p: "there has been an error"},
		{img: "",
			src: "error.png"}
	],
	style: "border-width:10;border-style:solid;"
};

//use it:
only.setHtml([
	//...
	errorMsg,
	//... more stuff
	errorMsg
]);

###Another example Simple user interaction:

var input = only.html({input: ""});
var submit = only.html({button: "Submit Name"})
var response = only.html({p: ""});

//no need for an id on the button
submit.onclick = function(){
	var name = input.value;
	response.innerHTML = "Hello " + name, " how are you today?";
}

only.setHtml([
	{p: "Please enter your name"},
	input,
	submit,
	response
]);