Hexo: Ignore dot file/folder in "layout/*"

Created on 26 Mar 2016  ·  8Comments  ·  Source: hexojs/hexo

It seems Hexo 3.2 breaks ignoring files, causing
TypeError: Cannot read property 'compile' of undefined.
See #1807, #1793 and many others.

source
Source folder. Place your assets (e.g. CSS and JavaScript files) here. Hexo ignores hidden files and files or folders prefixed with _ (underscore).

  1. ignoring files are processed and causes error

sh touch themes/landscape/layout/.DS_Store touch themes/landscape/layout/.gitkeep

  1. ignoring files in source with layout/ in path get processed #1793
    since it matched the pattern in hexo/lib/theme/processors/view.js
    (I tried to fix but failed)

sh touch themes/landscape/source/_css/layout/_sidebar.scss


Workaround 1: don't name any folder layout in theme (need code change)
https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak/issues/224#issuecomment-219365465

Workaround 2: downgrade to 3.1.1 :cry:
https://github.com/hexojs/hexo/issues/1793#issuecomment-213907822

bug feature-request

Most helpful comment

This also appears to occur if there is a folder named "layout" within the theme, besides the standard layout folder. I have a theme with a layout folder within assets, which was causing *.scss files to get picked up and then create this error.

All 8 comments

I deleted all the .DS_Store files in my hexo project folder but I still got the same 'compile' issue.

The "hexo generate" command works after I switch to the version 3.1.1 of Hexo.

To reproduce the problem, you need a .DS_Store file in the theme's layout folder (layout/.DS_Store), or at least that's how I was able to reproduce it in the theme I use.

In line 98 of hexo/lib/theme/view.js, var renderer = render.getRenderer(pathFn.extname(this.path)); tries to get the renderer for .DS_Store, as DS_Store is the file extension, and renderer returns as undefined.

One way to stop it would be to check typeof renderer !== 'undefined' but another would be to stop dot files or other ignores from even being processed upstream.

1851 .viminfo also cause error during deploy

.gitkeep also cause compile error

1857

1895

This also appears to occur if there is a folder named "layout" within the theme, besides the standard layout folder. I have a theme with a layout folder within assets, which was causing *.scss files to get picked up and then create this error.

1793 files with _ prefix

And in Mac OS X, it's a big problem that Mac OS X will create .DS_store in floders.

Was this page helpful?
0 / 5 - 0 ratings