@realsee/url-scanner
v0.0.7
Published
url-scanner
Downloads
471
Keywords
Readme
大部分时候我们使用静态资源时,会把静态资源上传到 CDN 上,然后在页面上引用 CDN 上的资源。例如:
<img src="https://ljcdn.com/logo.png" />但是对于像需要内网部署的项目,无法使用 CDN。
本工具的作用是:
- 扫描代码,下载页面中的静态资源
- 替换代码中的静态资源 url 前缀
注意:
本工具基于正则匹配,所以只能不能处理运行时动态计算的 url,例如:
<img src={`https://ljcdn.com/${logo}`} />也无法处理来自接口的 url。
开发
npm run build && node dist/index.js使用
npx @ke/scan-url -d # 下载资源
npx @ke/scan-url -r # 替换资源 url 前缀
npx @ke/scan-url -h # 查看帮助
Noncommercial example source
Run node example/scan.mjs --help for an inspectable noncommercially licensed CLI usage example. The example invokes the separately licensed scanner through a child process; it does not relicense the scanner itself. The legacy compressed scanning fixture is excluded from this and future package contents. See example/LICENSE and example/LICENSING.txt.
The example/template code uses the unmodified PolyForm Noncommercial License 1.0.0, whose permitted-purpose, modification and distribution terms govern. This does not change the proprietary agreement for the CLI/scanner or its SDK dependencies, or licenses previously granted for older copies.
