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

fis3-parser-dot-compiler

v0.0.4

Published

doT.js的fis3编译插件——一将doT模板编译成可直接在前端使用的js函数

Downloads

2

Readme

fis3-parser-dot-compiler

doT.js是一款高效的JS模板编译引擎。fis3-parser-dot-compiler插件基于fis3,提供将dot模板文件编译为纯js模板函数的功能。 编译后可以提升前端渲染性能,并且无需引入doT库文件。

##使用方法 在fis.conf中增加以下配置:

fis.match('*.dot', {
	parser: fis.plugin('dot-compiler', {varname: 'it'}),
	rExt: '.js'
})

将项目中的dot结尾的文件编译为同名js文件。

例如a.dot:

    <div class="wrap"> 
		<div class="cate_ranknews" data-js="rank">
			<span class="cate_rankicon"></span>
			<span class="cate_rankmore"><em class="moreicon"></em></span>
			<div cl ass="cate_rankfont">
				<h2>书城排行榜</h2>
				<p>今日男生榜、女生榜、新书榜等{{=it}}个榜更新</p>
			</div>
		</div>
	</div>
	<div class="blank_base"></div>

将会编译为:

$["a"]=function(it
/**/) {
var out=' <div class="wrap"> <div class="cate_ranknews" data-js="rank"><span class="cate_rankicon"></span><span class="cate_rankmore"><em class="moreicon"></em></span><div cl ass="cate_rankfont"><h2>书城排行榜</h2><p>今日男生榜、女生榜、新书榜等'+(it)+'个榜更新</p> </div></div></div><div class="blank_base"></div>';return out;
}

模板文件名.dot将会被编译成$("模板文件名")的模板函数。

##在网页中使用模板

//在js文件中导入模板
@require "./tmpl/tmpl_category_rank_news.dot"

//渲染
document.write($["a"](it));

##其他 可以配合fis3-prepackager-dot-compiler,将所有模板文件打包到一个js文件中,便于前端引用。