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

tpl-combo

v0.0.2

Published

To specify multiple templates into a js file

Downloads

3

Readme

tpl-combo

Introduction

To specify multiple templates into a js file 当你在做前端开发的时候,如有用过前端模板引擎,肯定会有遇到如下几点困惑:

  • 页面模板很多时,模板写到页面里感觉会特别的乱,而且会给页面大小带来额外的开销
  • 单独的把页面模板放到一个目录时,用起来比较麻烦,需要$.get去取,来回请求开销也很大
  • 或者我手工的把模板都写在一个模块里,但修改起来又增加了寻找的麻烦

现在你不用担心了,template-merge工具可以帮你搞得一切: 随心所欲的打包你模板文件 实时监听模板文件的修改,自动合并 生成文件为标准的CMD模块,方便引入

Usage

首先需要npm安装一下:

npm install -g tpl-combo

###命令行使用###

命令行下,可以先进入需要打包的文件所在目录,然后

tplcombo -p templates

第一个参数是源文件名,第二个参数是打包之后的文件名

其他选项有:

  • -p: path, 可以指定合并的目录路径
  • -o: output, 可以指定输入文件名,支持目录生成
  • -w: watch, 是否监听目录下文件,如有修改自动触发合并,默认不开启

在NodeJS里面使用

你也可以在自己的打包工具中调用tpl combo,和其他npm包一样:

var TPLCombo = require('tpl-combo');
TPLCombo.build(cfg, function(err){ callback(); });
  • cfg 参数可以配置以下选项:

    • path:{String} 入口目录
    • output:{String} 输出目录或者输出的完整路径(含文件名,推荐),可以使用相对路径
    • compress: {Boolean} 是否压缩,默认为true,处理规则同YUICompressor
    • debug: {Boolean} 是否打印日志

TODO

  • 压缩支持
  • 支持多文件打包形式
  • 模板包含,编译支持

ChangeList

  • 0.0.1:发布

License

tpl-combo 遵守 "MIT":https://github.com/weger/tpl-combo/blob/master/LICENSE.md 协议