生成 CF Pages 页面时,保护对 node_modules 的修改

Last updated on 2021-09-16, Thu, 12:25 AM

View in English

黑洞 node_modules 实在不能上云

我之前在 霍霍了一下我用的 hexo 主题,可直到最后才发现,对友链页面的布局修改没法被送到 Cloudflare, 因为咱对 node_modules 的修改没法推上去。

本地生成不合我的本意。

这样才好:

git push origin master

咋办呢?又不能把 node_modules 上云。

做人不能,至少不应该(

Overwrite!

不如等依赖装完以后重新覆盖一遍。

我真傻,真的…

把修改的文件丢进新的文件夹,起名叫 mod.

然后写个小脚本,让 CF 替我干活。

#!/bin/bash

hexo clean
cp -f mod/renderer.js node_modules/hexo-renderer-kramed/lib/  
cp -f mod/links.ejs node_modules/hexo-theme-fluid/layout/  
hexo g

添加执行权限。

chmod +x mod-build.sh

修改构建指令。

./mod-build.sh

下次 commit 时才会生效,那就再推一次。

git add .
git commit -S 
git push -u origin master

它工作。


生成 CF Pages 页面时,保护对 node_modules 的修改
https://blog.h3a.moe/src/d07367/
Author
H3arn
Posted on
2021-09-15, Wed, 11:36 AM
Updated on
2021-09-16, Thu, 12:25 AM
Licensed under