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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ruiyun/preact-multi-page-template

v1.2.20

Published

``` yarn yarn start ``` 之后访问http://{本机ip}:3000就可以看到页面

Downloads

85

Readme

快速开始

yarn
yarn start

之后访问http://{本机ip}:3000就可以看到页面

快速创建页面

yarn add-page

会依次提示你输入页面名(英文页面名)和页面标题(会显示在标题栏),之后会帮你创建好h5页面和小程序页面。 同时会在package.json中增加pages属性记下页面名和标题的对应关系。

构建目标全局变量

console.log($BUILD_TARGET$)
// 本地开发(yarn start) ==> local
// 测试环境(yarn build:dev) ==> dev
// 生产环境(yarn build:pro) ==> production

可以根据不同值来走不同api的endpoint

修改响应式基础

默认是按照移动端750px的设计的,如果要修改,可以在package.json里加一个属性p2rBase,值改为设计稿尺寸,比如1080。

修改默认页面模版

可以在项目根目录下放一个自定义的template.html

提取公文js库进common.js

package.json中有一个commonChunks属性,里面记录了要进common.js的包名。

自定义entry

方式一:

在/src/下建立一个entry.js,写入

export default function onEntry () {
  // 下面的代码每个页面初始化时都会执行
  console.log('hhh')
}

这个onEntry函数每个页面初始化都会执行。

方式二:

在 src/pages/{页面名}/ 下建立entry.js,写入

export default function onEntry () {
  // 下面的代码只有该页面初始化时会执行
  console.log('dddd')
}

这个onEntry函数只有这个页面初始化时才会执行。 方式二的entry会覆盖方式一。

自定义兼容性

默认的js和css兼容性是“last 2 versions”。如果不满足你的需要,可以在package.json中加入

{
  "browsers": [
    "android >= 4.4",
    "ios >= 8"
  ]
}

可以参考browserl.ist来设置你想要的兼容性。

自定义后编译的包

默认只会编译src下面的js文件。但是有些npm包是需要编译后再使用的(个人推荐这种方式),比如@ruiyun/preact-m-nav,@ruiyun/preact-layout-suite等。可以在package.json中加入

{
  "include": [
    "@ruiyun",
    "p-to-r",
    "h5-indicator"
  ],
}

来自定义加入需要后编译的包名。