OSDN Git Service

fixed map i think
[automap/automap.git] / Automap / MapSRC / build.js
index 7875da0..7b2be77 100755 (executable)
@@ -1,22 +1,23 @@
 #!/usr/local/bin/node
 
 // im sorry
-// cd into MapSRC and run node ./build.js and this will concat and stuff
+// run ./build.js and this will concat and stuff
 const fs = require('fs');
 
-fs.readFile('./src/Automap.html', 'utf8', (err, d) => {
+fs.readFile(__dirname + '/src/Automap.html', 'utf8', (err, d) => {
        if (err) console.log(err);
-       let outD = d.replace(/<link rel=\"stylesheet\" href=\"(.*)\">/g, '<style>REP:$1</style>')
-               .replace(/(<script type=\"text\/javascript\") src=\"(.*)\">/g, '$1>REP:$2')
-               .replace(/REP:(\w*\.\w*)/g, (match, name, offset, string) => {
-                       return fs.readFileSync('./src/' + name, 'utf8')
-                               .replace(/\/\/.*\n?/g, '');
+       let outD = d.replace(/<link rel=\"stylesheet\" href=\"(.*)\">/g, (match, name, offset, string) => {
+                       return '<style>' + fs.readFileSync(__dirname + '/src/' + name, 'utf8')
+                               // .replace(/\/\/.*\n?/g, '')
+                               + '</style>';
                })
-               .replace(/[\t\n]/g, '');
-       fs.writeFile('./dist/automap.html', outD, err => {
-               if (err) console.log(err);
-       });
-       fs.writeFile('../assets/automap/config/automap.html', outD, err => {
+               .replace(/<script type=\"text\/javascript\" src=\"(.*)\">/g, (match, name, offset, string) => {
+                       return '<script type=\"text\/javascript\">' + fs.readFileSync(__dirname + '/src/' + name, 'utf8')
+                               // .replace(/\/\/.*\n?/g, '')
+                               + '</script>';
+               });
+               // .replace(/[\t\n]/g, '');
+       fs.writeFile(__dirname + '/../assets/automap/config/automap.html', outD, err => {
                if (err) console.log(err);
        });
 });
\ No newline at end of file