Skip to content

Commit

Permalink
add support to priority
Browse files Browse the repository at this point in the history
  • Loading branch information
tsanie committed Jan 30, 2018
1 parent 98717a5 commit 043c8e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ filter_optimize:
# bundle loaded js file into the one
bundle: true
excludes:
# set the priority of this plugin,
# lower means it will be executed first, default is 10
priority: 12
```
## Comparison
Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ if (filterOptimize && filterOptimize.enable) {
filterOptimize.css = filterOptimize.css || {};
filterOptimize.js = filterOptimize.js || {};

var priority = parseInt(filterOptimize.priority);
if (isNaN(priority)) {
priority = 10;
}

// enable one of the optimizations
if (filterOptimize.css.enable || filterOptimize.js.bundle) {
hexo.extend.filter.register('after_generate', filter);
hexo.extend.filter.register('after_generate', filter, priority);
}
}

0 comments on commit 043c8e1

Please sign in to comment.