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

jade2

v1.11.0

Published

A clean, whitespace-sensitive template language for writing HTML

Downloads

4

Readme

Jade with optional tags

中文文档

It's a W3C's spec: http://www.w3.org/html/wg/drafts/html/master/syntax.html#optional-tags

Install

npm install cutsin/jade

Usage

bash$ jade foo bar --omitTag [safe|radical|unsafe|dangerous]
var jade = require('jade')
var options = {
	omitTag : 'radical'	// or 'safe' or 'unsafe' or 'dangerous'
}
var fn = jade.compileFile('./foo.jade', options)
var html = fn(locals)

Why?

  1. Why we need optional tags

  2. http://moonless.net/demo/optional-tags/

  3. In browser, before HTML minify and after it, the result is different, because browser must be generated implied end tags.

  4. In this w3's essay by Bert Bos, W3C/ERCIM, [email protected], he used vast numbers of omitted tags.

It's really safe?

  1. Sync with Jade, only a few changes.

  2. If you using default option: true or 'safe', it's just provide 12 absolutely safe tags, most browsers(IE6+/chrome/safari/Firefox/Opera/...) works perfect.

  3. Actually, it appeared in HTML 4.01, and we used many years on our corp's projects.

  4. In test case, other levels will be fallback to "safe" when using "pretty: true", because it's really unsafe with space character and comment by w3's SPEC.

Other features

<style>
.a li {display:block}
.b1 li {display:inline-block}
.b2 li {display:inline}
</style>
<ul class="a">
  <li>Hi~</li>
  <li>ForbesLindesay</li>
</ul>
<ul class="b1">
  <li>Hi~
  <li>ForbesLindesay
</ul>
<ul class="b2">
  <li>Hi~
  <li>ForbesLindesay
</ul>

In browser, the rendering results are different, because of white-space processing model

In addition, according to omitted tag's implicit rules, we can do a lot of useful things.

Values for Jade, it can be reduce indentationslike this:

Must be: omitTag: 'radical' at least

doctype html
html(lang="en")
//- `base` is a `head scope` only tag.
base(href="/n/contacts/")
p I'm main body.
ul
  li

It can resolve the different rendering results on browser side(white-space processing model) when using pretty: true

License

MIT