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-parser-config

v1.0.9

Published

fis-parser-config, use this plugin , you can esay to manage the front config variables.

Downloads

23

Readme

fis-parser-config

为了解决多站点域名各异以及一些前端变量在各个环境下的不同,而给程序带来复杂的判断逻辑、容易遗漏等问题。我们使用了fis-parser-config来通过前端编译,来替换设定的一些公共属性值。

安装插件

npm install -g fis-parser-config

fis3中添加插件

//以fis3为例
fis.match('*', {
	parser: fis.plugin('config', options)
})

options说明

| 参数 | 类型 | 可选 | 说明 | | :-------: | :------: | :-------: | :---- | | file | String | 是 | 指定读取键值的json文件,文件内容必须为标准JSON格式。 | | keys | JSON | 是 | 指定键值变量;若和file参数一起使用,两个参数执行的JSON对象将会合并,并且相同价值会覆盖file指定的数据。|

options详细实例:

fis.match('*', {
	parser: fis.plugin('config', {
		"file": "env/debug.json",
		"keys": {
			"version": "1.0.0"
		}
	})
})

使用规则举例

例如:配置中,声明了如下的数据。

{
  "key": "value",
  "key1": true,
  "key2": 1,
  "key3": "false"
}

那么在js中可以,使用如下的方式来获得。

编译前:

//方法1(推荐使用)
var key = __conf(key);        //string
var key1 = __conf(key1);      //boolean
var key2 = __conf(key2);      //number
//方法2(__confIn)
var key = "__confIn(key)";    
var key3 = __confIn(key3);    

编译后:

//方法1(推荐使用)
var key = "value";
var key1 = true;
var key2 = 1;
//方法2(__confIn)
var key = "value";
var key3 = false;

非js语法中,使用__confIn方式。

编译前:

<a href="__confIn(key)">得图网</a>

编译后:

<a href="value">得图网</a>