Skip to content

Commit

Permalink
refactor(render): destructure hexo-fs
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Dec 13, 2019
1 parent bc15c32 commit 06eeb69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/hexo/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const { extname } = require('path');
const Promise = require('bluebird');
const fs = require('hexo-fs');
const { readFile, readFileSync } = require('hexo-fs');

const getExtname = str => {
if (typeof str !== 'string') return '';
Expand Down Expand Up @@ -65,7 +65,7 @@ class Render {
if (data.text != null) return resolve(data.text);
if (!data.path) return reject(new TypeError('No input file or string!'));

fs.readFile(data.path).then(resolve, reject);
readFile(data.path).then(resolve, reject);
}).then(text => {
data.text = text;
ext = data.engine || getExtname(data.path);
Expand Down Expand Up @@ -98,7 +98,7 @@ class Render {

if (data.text == null) {
if (!data.path) throw new TypeError('No input file or string!');
data.text = fs.readFileSync(data.path);
data.text = readFileSync(data.path);
}

if (data.text == null) throw new TypeError('No input file or string!');
Expand Down

0 comments on commit 06eeb69

Please sign in to comment.