forked from aframevr/aframe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreghpages.js
executable file
·37 lines (30 loc) · 1.2 KB
/
preghpages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
const path = require('path');
const shell = require('shelljs');
const replace = require('replace-in-file');
// Inject `<meta>` tag for Chrome for Android's WebVR Origin Trial:
// https://webvr.rocks/chrome_for_android#what_is_the_webvr_origin_trial
const originTrialMetaTag = `
<!-- Origin Trial Token, feature = WebVR (For Chrome M59+), origin = https://aframe.io, expires = 2017-07-28 -->
<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M59+)" data-expires="2017-07-28" content="ArFv1ZeTwzkhjNE00uAE+XtiQB41fwqG/TqlFMLrepd9sforQSvQE/tgfIbUMYNuNre4QR1k4/z8xp2mV3dbhwwAAABeeyJvcmlnaW4iOiJodHRwczovL2FmcmFtZS5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViVlIxLjEiLCJleHBpcnkiOjE1MDEyMTcwMDIsImlzU3ViZG9tYWluIjp0cnVlfQ==">
`.trim();
const rootDir = path.join(__dirname, '..');
shell.cd(rootDir);
shell.rm('-rf', 'gh-pages');
shell.mkdir('-p', 'gh-pages');
shell.cp('-r', [
'.nojekyll',
'dist',
'examples',
'*.html',
'*.md'
], 'gh-pages');
function htmlReplace (before, after) {
replace.sync({
from: before,
to: after,
files: 'gh-pages/**/*.html'
});
}
htmlReplace('dist/aframe-master.js', 'dist/aframe-master.min.js');
htmlReplace('<head>', `<head>\n ${originTrialMetaTag}`);