Skip to content

Commit

Permalink
Change plugins loading order (#2736)
Browse files Browse the repository at this point in the history
* Change plugins loading order

Intuition says local changes should have precedence over external
ones, so this enforces the following load order:

external modules -> theme scripts -> local scripts

This way, any changes made locally will surely be applied.

* Fix code style error
  • Loading branch information
bolaum authored and NoahDragon committed Sep 5, 2017
1 parent dfb5a4b commit 658cc0f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/hexo/load_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ var chalk = require('chalk');
module.exports = function(ctx) {
if (!ctx.env.init || ctx.env.safe) return;

return Promise.all([
loadModules(ctx),
loadScripts(ctx)
]);
return loadModules(ctx).then(function() {
return loadScripts(ctx);
});
};

function loadModuleList(ctx) {
Expand Down Expand Up @@ -68,8 +67,8 @@ function loadScripts(ctx) {
}

return Promise.filter([
ctx.script_dir,
ctx.theme_script_dir
ctx.theme_script_dir,
ctx.script_dir
], function(scriptDir) {
// Ignore the directory if it does not exist
return scriptDir ? fs.exists(scriptDir) : false;
Expand Down

0 comments on commit 658cc0f

Please sign in to comment.