Closed vimcaw closed 6 years ago
I'm looking for the same thing. Found this plugin and it uses route.set
to generate hashed filenames
Unfortunately, the plugin doesn't fully work for me (I use the latest hexo version), but it may be a good direction.
@ertrzyiks
Thanks! It's exciting plugin!
But it turned my href
attribute into \undefined
after I enable it.
Maybe I can fix this.
@vimcaw yes, it generates '/undefined' for me too. Keep us posted if you manage to use it. I'm going to use some alternative approach (which I don't know yet)
@ertrzyiks I has found the reason which resulted in the bug and has partially fixed this, but it still has some bugs about asset-folders
path.
I believe I can fix it in recent days.
@ertrzyiks I has fixed this bug: V1.4.2 - Fixed: Revisioning turn src and href into undefined. \r\n- O… by vimcaw · Pull Request #15 · hexojs/hexo-asset-pipeline
@vimcaw excellent job! I'm only struggling with background-image
inline styles now. Probably just exclude from revisioning. Thanks for doing this!
@ertrzyiks It still has some bugs in the relative path and revisioning sequence. A temporary solution is to add error paths to exclude list
. I will try to fix them when I'm free.
There are 4 ways to achieve it:
webpack
to easily achieve it.webpack
or gulp
(commend to install at theme folder). first, webpack
or gulp
revision the files and output some files, then the themes use the outputed files.webpack
or gulp
(commend to install at root folder). first, hexo
generate the publish files, then webpack
or gulp
revision the files.
I use hexo to make my blog and make a theme updated frequently. Although I set
no-cache
oncache-control
, Chrome still caches my site file. After updating CSS and JS file and deploying, GitHub repo has updated, but my site still uses the old file for a long time. After I clear cache, it uses the new file, but I can't tell my visitor clear cache every time, right? I search some info and find Chrome will force cache site file. One solution is to add the md5 of the file to the filename. Such asmain?75f329868c94e5df.js
I search the plugin to do it for a long time but finding nothing can do it. I try to make a plugin, but hexo-fs can't rename a file.