前端静态资源发布时的部署工具
The solution of the uri
路径需要时posix型
需要io.js或者nodejs 4以上版本。因为使用了一些es6的特性:Set,Objec.assign等
使用说明
安装:
npm install -g yuji-pss
使用:
在运行相应目录下建立 pss.json
初次构建:
pss
增量构建:
cat a.txt|pss(也就是用管道传进来更改文件列表就行)
配置pss.json
{
"rootPath":"sampleProject",
"uriConfig": {
"baseUri":"/dist",
"protocol":"http://",
"suffix":"?v=1"
},
"ignore":[["^image/fis/article/","/.[^.]+$","^.[^.]+$"],[".html$"]],
"dir":["image","themes"],
"mapJsonPath":"demoout/map.json",
"outdir":"demoout"
}
其中各字段:
rootPath
:项目的根路径,相对cwd
uriConfig
: 生成的json中将包含,为生成url所需的各项配置
ignore
:构建中忽略的目录,注意要是正则字符串
dir
:需要构建的目录,值得注意的是,不参与构建的将会被原样输出(复制)到outdir
mapJsonPath
:存放map.json
的路径
outdir
:输出目录,将被转化为 $rootPath/../$outdir
增量构建所需的输入示例:
themes/images/plus.png
themes/images/weekly_giveaway_03.gif
themes/images/weekly_submit_03.gif
themes/images/weekly_giveaway_04.gif
themes/images/weekly_giveaway_02.png
也就是都是相对于rootPath
的相对路径