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

fdm-helper

v0.0.4

Published

fdm辅助模块,包括全局config的获取,实时刷新,编码设置,urlrewrite,urlconcat等中间件

Downloads

3

Readme

Neat(fdm) 辅助模块

模块功能

  • 获取fdmaven全局配置(neat.fdm/config.json), 全局管理rewrite等配置

  • livereload中间件,手动为html插入实时监听代码

  • setEncode中间件, 为响应头设置charset编码

  • urlRewrite中间件, 基于connect-modrewrite,基于正则的url重定向

  • urlConcat中间件,基于fd-middleware-concat, 支持styleCombine的url合并解析

安装最新版本

npm install fdm-helper --save

使用

example

var fdmHelper = require('fdm-helper'),
	server = connect();
server
	//实时刷新 
	.use(fdmHelper.liveInsert())
	//urlConcat
	.use(fdmHelper.urlconcat())
	// 重定向
	.use(fdmHelper.rewrite(["^(.*)$ http://42.156.140.62$1 [P]"]))
	// 设编码
	.use(fdmHelper.setEncode(['.js'],'gbk'))
	.use(connect.static(path.resolve('.')))
	.use(connect.directory(path.resolve('.')))
	.listen(SERVER_PORT || 80, next);

获取neat.fdm下的配置文件信息

require('fdm-helper').fdmConfig

livereload中间件

往html里插入实时监控代码,需与gulp/grunt的watch功能配合使用

{int} port:监听端口,默认35729

{String} basePath:文件根路径,默认当前路径

require('fdm-helper').liveInsert(port,basePath)

setEncode中间件

设置返回文件的charset, 用于处理文件和页面编码不一致

{Array} ext:文件后缀,默认['.js']

{String} encode:文件编码,默认utf8

require('fdm-helper').setEncode([ext],encode)

urlRewrite中间件

{Array} rules:重定向规则,参考

require('fdm-helper').rewrite([rules])

urlConcat中间件

参考

require('fdm-helper').urlconcat()