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

html-webpack-check-source-plugin

v1.2.0

Published

a plugin for html-webpack-plugin which can insert hint html source

Downloads

11

Readme

A plugin for html-webpack-plugin to check your state source

这是一个html-webpack-plugin的插件,可以在打包的时候检查资源是否符合参数要求

##用法

  • 需要先使用html-webpack-plugin
  • 在html-webpack-plugin后面增加下面代码
    var  HtmlWebpackCheckSourcePlugin = require('html-webpack-check-source-plugin'); 

    //plugin
    new HtmlWebpackCheckSourcePlugin({
        emitWarning: false,
        checkFn(resourceLink) {
            if (resourceLink.indexOf("http://") > -1) {
                return '链接带有http://'
            };
            if (resourceLink.indexOf('/lib/ts_sdk/test/core.js') > -1) {
                return '使用测试版资源'
            }
        }
    })

##选项

####open[选配][默认:true]

  • false:关闭插件
  • true:打开插件

####emitWarning[选配][默认:false]

  • false:抛出错误,中断打包进程
  • true:抛出警告

####checkFn[必填]

校验规则函数

checkFn(link:string)=> <string | boolean>

  • 返回string时,抛出的错误并提示return的内容
  • 返回boolean时,抛出错误并提示默认信息

##效果

输入

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
</head>

<body>
    this is the elememt;
    <img src="http://www.baidu.com" alt="">
    <img src="http://www.zhihu.com" alt="">
</body>
</html>

结果

#更新

  • v1.0.0 完善api
  • v1.1.0 增加报错文件名提示
  • v1.2.0 增加api:open