We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
源码地址: https://www.npmjs.com/package/@vuepress/plugin-last-updated?activeTab=code
这是一个使用JavaScript编写的VuePress插件脚本,用于获取页面源文件的最后一次Git提交时间戳,并将其添加到页面元数据中。以下是代码的概述:
它从Node.js导入了两个模块:path和cross-spawn包中的spawn。
它导出一个函数,该函数接受两个参数:options和context,并返回包含名为extendPageData的方法的对象。
extendPageData方法检索当前页面源文件的Git时间戳,并将其作为lastUpdated和lastUpdatedTimestamp属性添加到$page对象中。
如果提供了options.transformer函数,则使用它来将时间戳格式化为字符串表示形式;否则使用脚本中定义的defaultTransformer函数。
getGitLastUpdatedTimeStamp函数获取页面的文件路径,并使用spawn模块运行Git命令以检索修改文件的最后一次提交时间戳。然后解析并返回自Unix纪元以来的时间戳值(毫秒)。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
源码地址: https://www.npmjs.com/package/@vuepress/plugin-last-updated?activeTab=code
这是一个使用JavaScript编写的VuePress插件脚本,用于获取页面源文件的最后一次Git提交时间戳,并将其添加到页面元数据中。以下是代码的概述:
它从Node.js导入了两个模块:path和cross-spawn包中的spawn。
它导出一个函数,该函数接受两个参数:options和context,并返回包含名为extendPageData的方法的对象。
extendPageData方法检索当前页面源文件的Git时间戳,并将其作为lastUpdated和lastUpdatedTimestamp属性添加到$page对象中。
如果提供了options.transformer函数,则使用它来将时间戳格式化为字符串表示形式;否则使用脚本中定义的defaultTransformer函数。
getGitLastUpdatedTimeStamp函数获取页面的文件路径,并使用spawn模块运行Git命令以检索修改文件的最后一次提交时间戳。然后解析并返回自Unix纪元以来的时间戳值(毫秒)。
The text was updated successfully, but these errors were encountered: