feat: support more file extensions

based on the list by https://github.com/philnash/jekyll-gzip
This commit is contained in:
weyusi 2019-04-22 18:24:31 +09:30
parent 1ea89ec108
commit 49c9fcb310
1 changed files with 8 additions and 2 deletions

View File

@ -102,7 +102,10 @@ function logicGzip () {
let route = hexo.route let route = hexo.route
let routeList = route.list() let routeList = route.list()
return Promise.all(routeList.filter(path => (path.endsWith('.html') || path.endsWith('.js') || path.endsWith('.css') || path.endsWith('.xml') || path.endsWith('.json'))).map(path => { return Promise.all(routeList.filter(path => (path.endsWith('.html') || path.endsWith('.js') || path.endsWith('.css')
|| path.endsWith('.xml') || path.endsWith('.json') || path.endsWith('.txt')
|| path.endsWith('.ttf') || path.endsWith('.atom') || path.endsWith('.stl')
|| path.endsWith('.svg') || path.endsWith('.eot'))).map(path => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Grab all assets using hexo router // Grab all assets using hexo router
let assetPath = route.get(path) let assetPath = route.get(path)
@ -142,7 +145,10 @@ function logicBrotli () {
let route = hexo.route let route = hexo.route
let routeList = route.list() let routeList = route.list()
return Promise.all(routeList.filter(path => (path.endsWith('.html') || path.endsWith('.js') || path.endsWith('.css') || path.endsWith('.xml') || path.endsWith('.json'))).map(path => { return Promise.all(routeList.filter(path => (path.endsWith('.html') || path.endsWith('.js') || path.endsWith('.css')
|| path.endsWith('.xml') || path.endsWith('.json') || path.endsWith('.txt')
|| path.endsWith('.ttf') || path.endsWith('.atom') || path.endsWith('.stl')
|| path.endsWith('.svg') || path.endsWith('.eot'))).map(path => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Grab all assets using hexo router // Grab all assets using hexo router
let assetPath = route.get(path) let assetPath = route.get(path)