build beginner.html
This commit is contained in:
32
docs/beginner.html
Normal file
32
docs/beginner.html
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="./mini.css">
|
||||||
|
<title>30 seconds of code - Beginner Section</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="description" content="Curated collection of useful Javascript snippets that you can understand in 30 seconds or less.">
|
||||||
|
<meta name="keywords" content="javascript, snippets, code, programming">
|
||||||
|
<meta name="author" content="Angelos Chalaris (chalarangelo@gmail.com)">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta property="og:title" content="30 seconds of code">
|
||||||
|
<meta property="og:description" content="Curated collection of useful Javascript snippets that you can understand in 30 seconds or less." />
|
||||||
|
<meta property="og:type" content="website" /><meta property="og:image" content="favicon.png">
|
||||||
|
<link rel="icon" type="image/png" href="favicon.png">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="splash">
|
||||||
|
<h1 id="logo"><img src="https://30secondsofcode.org/favicon.png" alt="logo"> 30 seconds of code</h1>
|
||||||
|
<p id="tagline">Curated collection of useful JavaScript snippets<br id="tagline-lg"/> that you can understand in 30 seconds or less.</p>
|
||||||
|
<p id="doc-link"><a href="#" class="button">Home</a></p>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 col-md-10 col-lg-8 col-md-offset-1 col-lg-offset-2">
|
||||||
|
<h2 class="index-section">Beginner snippets</h2>
|
||||||
|
<p style="text-align: justify">The following section is aimed towards individuals who are at the start of their web developer journey.</p><br/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="container"><div class="row"><div class="col-sm-12 col-md-10 col-lg-8 col-md-offset-1 col-lg-offset-2"><p style="display:inline-block"><strong>30 seconds of code</strong> is licensed under the <a href="https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE">CC0-1.0</a> license.<br>Icons made by <a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a>.<br>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed by <a href="https://opensource.org/licenses/MIT">The MIT License</a><br>Built with the <a href="https://minicss.org">mini.css framework</a>.</p></div></div></footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -51,9 +51,13 @@ const snippetsPath = './snippets',
|
|||||||
docsPath = './docs';
|
docsPath = './docs';
|
||||||
// Set variables for script
|
// Set variables for script
|
||||||
let snippets = {},
|
let snippets = {},
|
||||||
|
beginnerSnippets = ['everyNth', 'filterNonUnique', 'last', 'maxN', 'minN', 'nthElement', 'sample', 'similarity', 'tail', 'currentURL', 'hasClass', 'getMeridiemSuffixOfInteger', 'factorial', 'fibonacci', 'gcd', 'isDivisible', 'isEven', 'isPrime', 'lcm', 'randomIntegerInRange', 'sum', 'reverseString', 'truncateString'],
|
||||||
startPart = '',
|
startPart = '',
|
||||||
endPart = '',
|
endPart = '',
|
||||||
output = '',
|
output = '',
|
||||||
|
startBegginerPart = '',
|
||||||
|
endBegginerPart = '',
|
||||||
|
beginnerOutput = '',
|
||||||
pagesOutput = [];
|
pagesOutput = [];
|
||||||
tagDbData = {};
|
tagDbData = {};
|
||||||
// Start the timer of the script
|
// Start the timer of the script
|
||||||
@ -65,8 +69,8 @@ try {
|
|||||||
startPart = fs.readFileSync(path.join(staticPartsPath, 'page-start.html'), 'utf8');
|
startPart = fs.readFileSync(path.join(staticPartsPath, 'page-start.html'), 'utf8');
|
||||||
endPart = fs.readFileSync(path.join(staticPartsPath, 'page-end.html'), 'utf8');
|
endPart = fs.readFileSync(path.join(staticPartsPath, 'page-end.html'), 'utf8');
|
||||||
|
|
||||||
beginnerStaticPart = fs.readFileSync(path.join(staticPartsPath, 'beginner-page-start.html'), 'utf8');
|
startBeginnerPart = fs.readFileSync(path.join(staticPartsPath, 'beginner-page-start.html'), 'utf8');
|
||||||
endStaticPart = fs.readFileSync(path.join(staticPartsPath, 'beginner-page-end.html'), 'utf8');
|
endBeginnerPart = fs.readFileSync(path.join(staticPartsPath, 'beginner-page-end.html'), 'utf8');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Handle errors (hopefully not!)
|
// Handle errors (hopefully not!)
|
||||||
console.log(`${chalk.red('ERROR!')} During static part loading: ${err}`);
|
console.log(`${chalk.red('ERROR!')} During static part loading: ${err}`);
|
||||||
@ -160,6 +164,22 @@ try {
|
|||||||
console.log(`${chalk.red('ERROR!')} During index.html generation: ${err}`);
|
console.log(`${chalk.red('ERROR!')} During index.html generation: ${err}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the output for the beginner.html file
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Add the static part
|
||||||
|
beginnerOutput += `${startBeginnerPart + '\n'}`;
|
||||||
|
beginnerOutput += `${endBeginnerPart}`;
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join(docsPath, 'beginner.html'), beginnerOutput);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.log(`${chalk.red('ERROR!')} During beginner.html generation: ${err}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Log a success message
|
// Log a success message
|
||||||
console.log(`${chalk.green('SUCCESS!')} index.html file generated!`);
|
console.log(`${chalk.green('SUCCESS!')} index.html file generated!`);
|
||||||
// Log the time taken
|
// Log the time taken
|
||||||
|
|||||||
Reference in New Issue
Block a user