mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-03 03:04:27 +02:00
build: build for netify
This commit is contained in:
parent
e987b9b6ab
commit
c2881e1956
2 changed files with 34 additions and 4 deletions
34
gulpfile.js
34
gulpfile.js
|
@ -1,5 +1,9 @@
|
||||||
var { execSync } = require('child_process');
|
var { execSync } = require('child_process');
|
||||||
var { writeFileSync, readdirSync, readFileSync } = require('fs');
|
var {
|
||||||
|
writeFileSync, readdirSync, readFileSync,
|
||||||
|
existsSync, statSync, mkdirSync, copyFileSync,
|
||||||
|
} = require('fs');
|
||||||
|
var path = require('path');
|
||||||
|
|
||||||
var glob = require('glob');
|
var glob = require('glob');
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
@ -48,6 +52,22 @@ const lintStrings = (done) => {
|
||||||
|
|
||||||
var destDir = './build/';
|
var destDir = './build/';
|
||||||
|
|
||||||
|
var copyRecursiveSync = (src, dest) => {
|
||||||
|
var exists = existsSync(src);
|
||||||
|
var stats = exists && statSync(src);
|
||||||
|
var isDirectory = exists && stats.isDirectory();
|
||||||
|
if (isDirectory) {
|
||||||
|
mkdirSync(dest);
|
||||||
|
readdirSync(src).forEach((childItemName) => {
|
||||||
|
copyRecursiveSync(
|
||||||
|
path.join(src, childItemName),
|
||||||
|
path.join(dest, childItemName));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
copyFileSync(src, dest);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var buildIndex = function(done) {
|
var buildIndex = function(done) {
|
||||||
log('Building index...');
|
log('Building index...');
|
||||||
|
|
||||||
|
@ -72,8 +92,11 @@ var buildIndex = function(done) {
|
||||||
}
|
}
|
||||||
log('Found hashed style file: ' + styleFile);
|
log('Found hashed style file: ' + styleFile);
|
||||||
|
|
||||||
|
var buildDir = process.env.CI ? '.' : 'build';
|
||||||
|
|
||||||
// output these filenames to our index template
|
// output these filenames to our index template
|
||||||
var outputIndex = indexTemplate({
|
var outputIndex = indexTemplate({
|
||||||
|
buildDir,
|
||||||
jsFile,
|
jsFile,
|
||||||
styleFile,
|
styleFile,
|
||||||
});
|
});
|
||||||
|
@ -86,7 +109,14 @@ var buildIndex = function(done) {
|
||||||
removeComments: true,
|
removeComments: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
writeFileSync('index.html', outputIndex);
|
|
||||||
|
if (process.env.CI) {
|
||||||
|
writeFileSync('build/index.html', outputIndex);
|
||||||
|
copyRecursiveSync('assets', 'build/assets');
|
||||||
|
copyRecursiveSync('lib', 'build/lib');
|
||||||
|
} else {
|
||||||
|
writeFileSync('index.html', outputIndex);
|
||||||
|
}
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<meta property="og:description" content="An interactive Git visualization tool to educate and challenge!"/>
|
<meta property="og:description" content="An interactive Git visualization tool to educate and challenge!"/>
|
||||||
<meta http-equiv="content-language" content="en">
|
<meta http-equiv="content-language" content="en">
|
||||||
|
|
||||||
<link rel="stylesheet" href="build/{{styleFile}}" type="text/css" charset="utf-8">
|
<link rel="stylesheet" href="{{buildDir}}/{{styleFile}}" type="text/css" charset="utf-8">
|
||||||
<link rel="icon" href="assets/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="assets/favicon.ico" type="image/x-icon">
|
||||||
|
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@
|
||||||
For a much easier time perusing the source, see the individual files at:
|
For a much easier time perusing the source, see the individual files at:
|
||||||
https://github.com/pcottle/learnGitBranching
|
https://github.com/pcottle/learnGitBranching
|
||||||
-->
|
-->
|
||||||
<script defer src="build/{{jsFile}}"></script>
|
<script defer src="{{buildDir}}/{{jsFile}}"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- lol noscript. I did not write 9k+ lines of JS just for you to bounce off my website -->
|
<!-- lol noscript. I did not write 9k+ lines of JS just for you to bounce off my website -->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue