๐Ÿ“ฆ D-Sketon / hexo-minecraft-skin-viewer

๐Ÿ“„ index.js ยท 23 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23const path = require('path');
const fs = require('fs');
const _ = require('underscore');

let filePath = path.resolve(__dirname, 'templates/mcskin.html');

function mcskin(args) {
  let template = fs.readFileSync(filePath).toString();
  return _.template(template)({
    id: 'mcskin' + ((Math.random() * 9999) | 0),
    type: args[0],
    content: args[1],
    autoRotate: args[2] || true,
    animation: args[3] || false,
    width: args[4] || 300,
    height: args[5] || 400
  });
}

hexo.extend.tag.register('mcskin', mcskin, {
  async: true
});