Giter Club home page Giter Club logo

Comments (2)

Charles7c avatar Charles7c commented on July 18, 2024

article-data.json 是通过 collect-article-data.mjs 这个脚本生成的网站数据。

await fs.writeFile('./article-data.json', JSON.stringify(articleData), 'utf-8')

因为在命令前带上了 node collect-article-data.mjs,所以在运行 pnpm dev、pnpm review、pnpm build 的时候都会执行 collect-article-data.mjs 脚本。

"dev": "node collect-article-data.mjs && vitepress dev docs", 

"scripts": {
"dev": "node collect-article-data.mjs && vitepress dev docs",
"preview": "node collect-article-data.mjs && vitepress preview docs",
"build": "node collect-article-data.mjs && vitepress build docs"
},

这部分其实有两个优化点:
1.现在 VitePress 已经支持了一些新的玩法,可以在指定时期做一些处理,这样就可以不用在执行命令的时候都在前面带上 node collect-article-data.mjs 了;
2.VitePress 后续可能会支持 usePageData 类似的网站全部数据 API,这样就更不需要 collect-article-data.mjs 脚本了。

最近工作太忙,还开源了另一个项目,所以没时间适配 VitePress 新 API。如果你有时间的话,非常期待你研究下第1个优化点,顺便帮忙给这个项目 PR 一下。:smile:

from charles7c.github.io.

mafqla avatar mafqla commented on July 18, 2024

好的,谢谢大佬了

from charles7c.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.