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

tag-lang-loader

v0.3.2

Published

基于Tag的前端多语言方案

Downloads

2

Readme

#tag-lang-loader 前端多语言方案

#使用方式

官网文档: http://nodejs.cn/api/fs

##安装

npm i tag-lang-loader --save-dev

##命令行:

Usage: tag-lang-cli -s 源文件夹 -t 目标文件夹 -f 文件类型 -c 配置 -l 当前语言类型标签 -e

Options:

-V, --version                   output the version number
-s, --source <源文件夹>             
-t, --target [目标文件夹]            
            如果为空,则等于 source。 
            如果 source 是以 _lang结尾,则 target 用语言代码替换结尾的 lang。
-f, --file-type <文件类型>          如:-f js,css
-c, --config <配置>               使用伪Json格式,key表示tagName,value表示语言代码。如:-c c:cn,e:en
-l, --language [当前语言]           仅编译当前语言,配置项的key值。
-e, --as-service [编译完后,后台继续运行]  
-h, --help                      output usage information

如:tag-lang-cli -f vue,js,html -c c:cn,c:en -e -s ../pzx_vue2/src_lang -l c

##原理 监控一个文件夹,对文件进行转换,并把转换后的内容保存到另一个文件夹中。 转换的规则是:

<div><c>中文资源</c><e>英文资源</e></div

如以上命令行。 把 中文资源保留,把英文资源去除。以上写法,在任何位置都有效。 如:标签,字符串,注释。 转换结果显示:

中文资源

##简写 简写时转义,编译的内容不能包含:

  • 大于号 >
  • 小于号 <
  • 双引号 "
  • 单引号 ' 如果编译的内容没有特殊字符,那么可以简写成:
<div>中文资源<ce>英文资源</div>

前面的部分,先遇到 双引号("),单引号(') 表示在字符串中,会向后找闭合引号; 先遇到 大于号(>) 表示在Dom中,会向后找 小于号(<)。

以下情况会编译出错,不能使用简写:

<div>"鲁迅说:<ce>‘luxun says:</div>
<div>鲁迅说:><ce>luxun says:></div>

##对webpack进行改造

src_lang 保存源码。
src_cn   保存转换的中文站点
src_en   保存转换的英文站点

dist_cn  保存打包的中文站点
dist_en  保存打包的英文站点