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

fis-postpackager-tolist

v0.0.9

Published

一个fis的插件,针对需要生成很多个相同模板的页面出来的需求

Downloads

10

Readme

用于前端需要为同一个模板生成多个页面出来(静态页面)

属于Fis的插件,模板语言采用ejs(类原生js语法)

FIS配置如下:

    //配置
    modules : {
    	postpackager : 'tolist'
    },
    settings : {
    	postpackager : {
    		tolist : {
                input : 'template/hero.tmpl',//模板文件
                data : 'config/hero.json',//模板数据
                output : 'herolist',//静态页面输出到哪个文件夹,不存在会自动新建
                charset : 'gbk' //静态文件的编码
            }
    	}
    }

使用如下:

	//模板页面hero.tmpl
    <!--此乃ejs模板-->
    <p>id:<%=id%></p>
    <p>名字:<%=name%></p>
    <p>头像:<img src="<%=pic%>" /></p>
	//此乃hero.json,根一定是data,而且是一个数组
	//数据对象需要有两个属性,一个是id,一个是info
	//id是最终生成的html静态文件的名字
	//info是提供给模板的数据,资源路径使用相对于项目根路径的
	{
	    "data":[
	    	{
		    	"id": "1",
		    	"info" : {
		    		"id" : "1",
		    		"name" : "test1",
		    		"pic" : "data/demo.png"
		    	}
	    	},
	    	{
	    		"id": "2",
		    	"info" : {
		    		"id" : "2",
		    		"name" : "test2",
		    		"pic" : "img/_icon_hot.png"
		    	}
	    	}
	    ]
	}

最终生成如下:

	//1.html(2.html类似,只是数据不同)
    <!--此乃ejs模板-->
    <p>id:2</p>
    <p>名字:test</p>
    <p>头像:<img src="http://domain.com/data/demo.png" /></p>