红叶Hexo程序员

Hexo 编译文档时 JS 混乱解决方案

2017-03-03  本文已影响122人  红叶丶秋鸣

之前为在 GitHub 博客上写自己的 html 网页,在 hexo 根目录下的 source 文件夹中放了自己的 js 文件,每次 hexo g 后,pubic 文件夹中的 js 文件就混乱了,与自己实际 js 不一致。

解决方案:

  1. hexo g 编译后在 public 文件夹中修改,将自己的 js 文件覆盖 hexo 编译后的 js 文件。或者 hexo d 提交到 GitHub 后直接到 GitHub 线上修改 js 文件。
  2. 博客中的 js 引用使用外链的形式。如将 js 文件上传七牛云,引用七牛云上的 js。
  3. 跳过 hexo 渲染【推荐】。
    Hexo 3.0 以下使用:
    在主目录下添加 README.md 文件或者 html 文件。
    Hexo 3.0 以上支持:
    修改 Hexo 主目录下的 _config.yml 配置文件中的 skip_render 参数。
skip_render: "test.html"    # source 文件夹下指定文件

skip_render: test/*    # 单个文件夹下全部文件

skip_render: test/*.md    # 单个文件夹下指定类型文件

skip_render: test/**    # 单个文件夹下全部文件及子文件

skip_render:         # 多个文件夹以及其他情况
    - test/*
    - test/*.html

注:若修改配置后不见效果,先执行 hexo clean 后再执行 hexo g 重新编译
原文>>
Hexo 常见问题解决方案

上一篇 下一篇

猜你喜欢

热点阅读