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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mod-jst

v0.0.3

Published

Compile underscore templates to JST file

Downloads

8

Readme

#mod-jst

把underscore模版编译为jst的modjs任务插件,并支持模版嵌套

##安装配置说明 ###安装: npm install mod-jst -g

###Mod配置(Modfile.js)

module.exports = {
    plugins: {
        "jst": "mod-jst"
    },
    tasks: {
        "jst": {
            namespace: 'JST',
            src: 'template/*.html',
            dist: 'js/template.js',
            charset: 'utf-8',
            templateName: function (fileName) {
                if (!fileName) {
                    return '';
                }
                return fileName[0] === '_' ? '' : fileName;
            },
            templateSettings: {
                evaluate: /<%([\s\S]+?)%>/g,
                interpolate: /<%=([\s\S]+?)%>/g,
                escape: /<%-([\s\S]+?)%>/g,
                partial: /<%@([\s\S]+?)%>/g
            },
            moduleDefinition: 'amd',
            underscore: 'underscore'
        }
    }
};

###选项说明

####namespace 类型: String 默认值: 'JST' 说明: 所有template方法的namespace,在moduleDefinition不为'amd'或者'cmd'时有效

####charset 类型: String 默认值: 'utf-8' 说明: 所有template文件的字符集编码

####templateName 类型: Function 默认值:

function (fileName) {
    if (!fileName) {
        return '';
    }
    return fileName[0] === '_' ? '' : fileName;
} 

说明: 由template文件的名称转换为template方法名的转换方法,如果返回空字符串则该template不生成(例如内嵌的模版),默认方法中文件名称以'_'开头的不生成,其他直接用文件名作为方法名

####templateSettings 类型: Object 默认值:

{
    evaluate: /<%([\s\S]+?)%>/g,
    interpolate: /<%=([\s\S]+?)%>/g,
    escape: /<%-([\s\S]+?)%>/g,
    partial: /<%@([\s\S]+?)%>/g
}

说明: 所有template文件匹配串正则,前3项参考underscore的template方法,最后一项为嵌套模版语法<%@test.html%>

####moduleDefinition 类型: String 默认值: '' 说明: 模块化包装器类型 (amd/cmd),如果非'amd'或者'cmd',则使用namespace作为对象名,直接生成模版方法

####underscore 类型: String 默认值: 'underscore' 说明: cmd中的underscore模版require标示,比如设置为'./underscore',生成代码:

var _ = require('./underscore');