Skip to content

SheldonLaw/auto-timestamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-timestamp

Add timestamp for resources to handle version control automatically.

Usage

Install

npm i auto-timestamp

Go ahead

const path = require('path');
const AutoTimestamp = require('auto-timestamp');

// 配置静态资源路径 - 缩小搜索范围
const staticPaths = [
	path.join(__dirname, './static'),
];
// 配置静态资源过滤器
const blockResourceType = ['html'];
const staticFilter = function(filePath) {
	const extname = path.extname(filePath);
	// 过滤如 .DS_Store等文件
	if (extname == '') return false;
	// 过滤自定义的资源类型
	if (blockResourceType.indexOf(extname.substr(1)) != -1) return false;
	// 过滤lib库
	if (filePath.match('lib')) return false;
	return true;
}
const autoTimestamp = new AutoTimestamp({
	staticPaths: staticPaths,
	staticFilter: staticFilter, // 可选
	documentRoot: __dirname // if you use seajs, you should tell me where is your document root.
});
// 配置入口路径
const entranceList = [
	path.join(__dirname, 'index.html'),
];
// 运行
autoTimestamp.run(entranceList);

About

A mini npm module to add timestamp for resources to handle version control automatically.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published