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

webpack-dps-spa-plugin

v0.1.3

Published

单页面多路由骨架屏插件

Downloads

3

Readme

webpack-dps-spa-plugin

单页面多路由骨架屏插件

AutoDpsPlugin

Kind: global class

new AutoDpsPlugin(options)

自动渲染骨架屏插件

| Param | Description | | --- | --- | | options | 插件配置 | | options.server | 渲染骨架屏本地服务配置 | | options.server.port | 本地服务端口,默认从8000开始寻找 | | options.server.proxy | 本地服务反向代理配置与devServer.proxy一致,如果为value为函数则为中间件,否则为http-proxy-middleware | | options.insertEl | 骨架屏元素插入到html的父标签,默认 #skeleton | | options.routeMode | 路由模式,默认 history | | options.limit | 同时渲染骨架屏路由数量,默认 5 | | options.staticDir | 打包输出目录(index.html输出目录),默认 项目根目录下的dist目录 | | options.enableAutoSkeletonRoutes | 是否采用自动配置路由,必须使用 auto-routing 插件 | | options.skeletonRoutes | 需要渲染的骨架屏路由配置,enableAutoSkeletonRoutes 为 false 可用 | | options.await | 等待时间(ms),默认0 |

options.skeletonRoutes

| Param | Description | | --- | --- | | name | 必须和路由定义的name一致 | | path | 匹配当前路由的正则 | | pathname | 访问路由的path地址,例如: /mn/demo | | skeletonId | 骨架屏路由ID,唯一即可 |

dps.config.js 额外参数

| Param | Description | | --- | --- | | inject | 注入window变量值 | | injectProperty | 注入window变量属性名 | | launch | puppeteer 启动参数配置 |

使用

webpack chainWebpack 添加插件

config.plugin('AutoDpsPlugin')
    .use(AutoDpsPlugin, [{
      enableAutoSkeletonRoutes: true,
      limit: 5,
      server: {}
    }]);

enableAutoSkeletonRoutes

添加 vue-cli-auto-routing 插件,在路由页面配置<route>

<route>
{
    "meta": {
        "skeleton": true
    }
}
</route>

or

<route>
{
    "meta": {
        "skeleton": {
            "name": "home",
            "path": /^\/mn\/home/
            "pathname": "/mn/home",
            "skeletonId": "home"
        }
    }
}
</route>

自定义返回数据

dpsServer: {
    proxy: {
        '^/app-gateway/demo': (req, res) => {
            res.json({code: 200, data: {}});
            res.end();
        }
    }
}