OSDN Git Service

fully implement the most advanced version of the map so far
[automap/automap.git] / Automap / MapSRC / build.js
1 #!/usr/local/bin/node
2
3 // im sorry
4 // cd into MapSRC and run node ./build.js and this will concat and stuff
5 const fs = require('fs');
6
7 fs.readFile('./src/Automap.html', 'utf8', (err, d) => {
8         if (err) console.log(err);
9         let outD = d.replace(/<link rel=\"stylesheet\" href=\"(.*)\">/g, '<style>REP:$1</style>')
10                 .replace(/(<script type=\"text\/javascript\") src=\"(.*)\">/g, '$1>REP:$2')
11                 .replace(/REP:(\w*\.\w*)/g, (match, name, offset, string) => {
12                         return fs.readFileSync('./src/' + name, 'utf8')
13                                 .replace(/\/\/.*\n?/g, '');
14                 })
15                 .replace(/[\t\n]/g, '');
16         fs.writeFile('./dist/automap.html', outD, err => {
17                 if (err) console.log(err);
18         });
19         fs.writeFile('../assets/automap/config/automap.html', outD, err => {
20                 if (err) console.log(err);
21         });
22 });