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

hx-ths-cli

v1.3.7

Published

一个简单的替换前端项目中的相对地址为绝对地址

Downloads

3

Readme

ths-cli

一个简单的cdn地址替换命令行工具(适用ths)

工具会对页面中的css,js,以及图片地址进行cdn地址转换,需要在link,script标签添加cdn即可(例如:<link href="./styles/index.css" cdn>

js地址可以进行合并也可以针对某个js单独生成cdn地址,如需单独生成才需要在script标签中添加single(例如:<script src="./scripts/index.js" single></script>),出现single就不必在加cdn,默认会对添加 cdn属性值相等的的script标签 按顺序进行合并。如果添加cdn的标签只有一个则不会使用合并语法。

工具会自动修改css和html文件中的图片引用地址,但不会处理js中的地址

会对js,css文件进行压缩,会保留原始文件,上传静态资源服务器时只需上传压缩文件即可。

安装

npm install ths-cli -g

使用

使用 ths-cli cdn 执行默认的cdn替换

使用 ths-cli cdn -t 20180202指定cdn时间戳

使用 ths-cli init 初始化配置文件

使用 ths-cli create 创建开发目录

使用 ths-cli test 测试替换的cdn地址

#配置文件有三个配置项

cdn --> cdn地址

build --> 对应打包后的目录,不能与当前目录中的文件夹同名

ignore --> 打包时需要忽略的目录

1.3.7 新增功能

  • 创建env.config.json文件,为内网ci构建做准备
  • 命令行增加-d 或者--default参数,跳过可交互式命令行,确认默认配置打包例如:
  hx-ths-cli cdn --default -t 20220421 或
  hx-ths-cli cdn -d -t 20220421