Skip to content
New issue

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

Add image files to draft asset folder, hexo failed to start server #797

Closed
timnew opened this issue Aug 14, 2014 · 10 comments
Closed

Add image files to draft asset folder, hexo failed to start server #797

timnew opened this issue Aug 14, 2014 · 10 comments
Labels
bug Something isn't working post-asset

Comments

@timnew
Copy link
Contributor

timnew commented Aug 14, 2014

I just added 2 image files to the draft asset folder, and I found following error:

[timnew] hexo server -d                                                      23:33:30  ☁  hexo ☂ ⚡ ✭
Deprecation warning: moment().lang() is deprecated. Use moment().localeData() instead.
[error] HexoError: Process failed: _drafts/Atom-Editor-Background-Image/no_treeview.png
SyntaxError: Unexpected token ;
  at Object.Function (<anonymous>:null:null)
  at [object Object].precompile (/usr/local/lib/node_modules/hexo/node_modules/swig/lib/swig.js:483:11)
  at [object Object].compile (/usr/local/lib/node_modules/hexo/node_modules/swig/lib/swig.js:588:16)
  at Object.render (/usr/local/lib/node_modules/hexo/node_modules/swig/lib/swig.js:507:17)
  at /usr/local/lib/node_modules/hexo/lib/post/render.js:61:29
  at /usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:610:21
  at /usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:249:17
  at iterate (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:149:13)
  at async.eachSeries (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:165:9)
  at _asyncMap (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:248:13)
  at Object.mapSeries (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:231:23)
  at Object.async.series (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:608:19)
  at Object.module.exports [as render] (/usr/local/lib/node_modules/hexo/lib/post/render.js:57:9)
  at Array.async.auto.post [as 2] (/usr/local/lib/node_modules/hexo/lib/plugins/processor/post.js:193:17)
  at listener (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:493:46)
  at /usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:444:17
  at Array.forEach (native)
  at _each (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:46:24)
  at Object.taskComplete (/usr/local/lib/node_modules/hexo/node_modules/async/lib/async.js:443:13)
  at processImmediate [as _immediateCallback] (timers.js:330:15)

It seems the image files is recognized as markdown source file??? Wield

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 14, 2014

.png can't be placed in _drafts or _posts.
all files in them will be render by hexo.

@tommy351
Copy link
Member

It may be a bug. I'll check it later.

@tommy351 tommy351 added the bug label Aug 14, 2014
@timnew
Copy link
Contributor Author

timnew commented Aug 14, 2014

BTW @tommy351 what is the recommended way to reference images in asset folder?

I wish I just type file name in the .md, so the link won't broken if I renamed the post.
But I wish to get a full url in the html after rendered. So the image can be displayed properly in archive page or home page.

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 14, 2014

Create an imgs floder in source floder.
And your can get the full url by raw in github,.

------------------ 原始邮件 ------------------
发件人: "TimNew"notifications@github.com;
发送时间: 2014年8月15日(星期五) 凌晨0:28
收件人: "hexojs/hexo"hexo@noreply.github.com;
抄送: "漩涡"vars.cn@gmail.com;
主题: Re: [hexo] Add image files to draft asset folder, hexo failed tostart server (#797)

BTW @tommy351 what is the recommended way to reference images in asset folder?

I wish I just type file name in the .md, so the link won't broken if I renamed the post.
But I wish to get a full url in the html after rendered. So the image can be displayed properly in archive page or home page.


Reply to this email directly or view it on GitHub.

@tommy351
Copy link
Member

@timnew It's the only way to reference images in asset folder so far. I'm trying to write a new sort of filter to solve this problem.

@timnew
Copy link
Contributor Author

timnew commented Aug 14, 2014

@tommy351 understand. Any progress of the filter? Since I just started to create the asset image filter.

Besides I think if there is a plug-in that can delete empty asset folder could be also useful.
But I'm not sure which kind of plug-in it should belongs to? Maybe a generator? Or maybe something out of Hexo, such as a gulp task.
Any idea?

@timnew
Copy link
Contributor Author

timnew commented Aug 15, 2014

Just published hexo-tag-asset-res to reference the files in asset folder with relative path

@vallettea
Copy link

I'm also interested by the resolution of this bug

@leesei
Copy link
Member

leesei commented Feb 22, 2016

Try Asset Folders and open new issue if it is not working as expected.

@leesei leesei closed this as completed Feb 22, 2016
@leesei
Copy link
Member

leesei commented Feb 26, 2016

This issue seems to be fixed in 3.2beta
https://github.com/leesei/hexo-vanilla-site/tree/master/source/_drafts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working post-asset
Projects
None yet
Development

No branches or pull requests

5 participants