Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Initial commit, based off the HTML5 Boilerplate template.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhartman committed Sep 11, 2018
0 parents commit c565a67
Show file tree
Hide file tree
Showing 51 changed files with 4,957 additions and 0 deletions.
5 changes: 5 additions & 0 deletions _espresso.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "HTML5 Boilerplate",
"description": "The official H5BP website boilerplate.",
"context": "*"
}
73 changes: 73 additions & 0 deletions _generator-settings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<form onsubmit="assistant.finish(); return false;">
<section>
<h4>Choose a base:</h4>

<input type="radio" name="base" value="none" checked="true">
<strong>None</strong>
<span>Start with just the basics.</span>
<br/>

<input type="radio" name="base" value="responsive">
<strong>Responsive</strong>
<span>A mobile-first, responsive design</span>
<br/>

<input type="radio" name="base" value="bootstrap">
<strong>Bootstrap</strong>
<span>A mobile-first, responsive design using the Bootstrap framework.
<br/>
</section>

<section>
<h4>Choose an HTML5 Fallback:</h4>

<input type="radio" name="polyfill" value="modernizr" checked="true">
<strong>Modernizr</strong>
<span>Check each HTML5 feature natively and add basic DOM support for unrecognized elements.</span>
<br/>

<input type="radio" name="polyfill" value="html5shim">
<strong>HTML5Shim</strong>
<span>Add basic DOM support for unrecognized elements.</span>
<br/>
</section>


<section>
<h4>Extras</h4>

<input type="checkbox" name="ieTags" checked="true">
<strong>IE Classes</strong>
<span>Include classes in the markup for Internet Explorer.</span>
<br/>

<input type="checkbox" name="serverExtras">
<strong>Server Extras</strong>
<span>Include .htaccess, robots.txt, a 404 landing page, etc.</span>
<br/>

<input type="checkbox" name="ga" onclick="h5bp.toggle_gaSiteId();" >
<strong>Google Analytics</strong>
<span>Insert markup for Site ID: <input type="text" name="ga_siteId" placeholder="UA-XXXXX-X" disabled="true"></span>
<br/>
</section>
</form>

<script>
window.h5bp = {
toggle_gaSiteId: function() {
var siteId = document.querySelector('input[name=ga_siteId]');

if (document.querySelector('input[name=ga]').checked) {
siteId.disabled = false;
siteId.focus();
}
else {
siteId.disabled = true;
siteId.value = '';
}

return true;
}
};
</script>
99 changes: 99 additions & 0 deletions _generator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
var vendorScriptMap = {
bootstrap: 'bootstrap-3.1.1.min.js',
html5shim: 'html5shim-3.6.min.js',
respond: 'respond-1.1.0.min.js',
jquery: 'jquery-1.11.0.min.js',
modernizr: 'modernizr-2.6.2.min.js',
modernizr_responsive: 'modernizr-2.6.2-respond-1.1.0.min.js'
};

generator.applyToOutputNode = function(outputFolderNode, inputFolderNode) {

// Read config and set default values
var config = generator.config || {};
config.base = config.base || 'none';
config.polyfill = config.polyfill || 'modernizr';
config.serverExtras = !!config.serverExtras;
config.ieTags = (config.ieTags === undefined) ? true : !!config.ieTags;
config.ga = !!config.ga;
config.ga_siteId = config.ga ? config.ga_siteId || '' : undefined;

// Add common files from H5BP
var boilerplateInputNode = inputFolderNode.folderForPath('html5-boilerplate-4.3.0');
var boilerplateOutputNode = outputFolderNode.addFolderAtPath(boilerplateInputNode, './', OverwriteOnConflict);

var excludePaths = ['CHANGELOG.md', 'CONTRIBUTING.md', 'css/', 'doc/', 'index.html', 'README.md', 'js/vendor/'];
if (!config.serverExtras) {
excludePaths = excludePaths.concat(['.htaccess', '404.html', 'crossdomain.xml', 'humans.txt', 'robots.txt']);
}

excludePaths.forEach(function(excludePath) {
var currentNode = null;

if (excludePath.slice(-1) === '/') {
currentNode = boilerplateInputNode.folderForPath(excludePath);
}
else {
currentNode = boilerplateInputNode.fileForPath(excludePath);
}

boilerplateOutputNode.excludeNode(currentNode);
});

// Add vendor script libraries
function addVendorScript(vendorFileName) {
if (vendorFileName) {
var vendorInputFile = inputFolderNode.fileForPath('vendor-scripts/' + vendorFileName);
outputFolderNode.addFileAtPath(vendorInputFile, 'js/vendor/' + vendorFileName, OverwriteOnConflict);
}
};

addVendorScript(vendorScriptMap.jquery);
addVendorScript(vendorScriptMap[config.polyfill]);

if (config.base === 'responsive' || config.base === 'bootstrap') {
addVendorScript(vendorScriptMap.respond);
}

if (config.base === 'bootstrap') {
addVendorScript(vendorScriptMap.bootstrap);
}

// Add template styles
var styleInputFolderNode = inputFolderNode.folderForPath('templates/' + config.base);

if (styleInputFolderNode !== null) {
for (var i = 0, styleChildNodes = styleInputFolderNode.childNodes; i < styleChildNodes.length; i++) {
var childNode = styleChildNodes[i];
var childNodePath = childNode.path.split('/').slice(2).join('/');

if (childNode.type === FolderNode) {
outputFolderNode.addFolderAtPath(childNode, childNodePath);
}
else {
outputFolderNode.addFileAtPath(childNode, childNodePath);
}
}
}

// Translate our configuration to the index page
var boilerplateIndexNode = outputFolderNode.fileForPath('index.html');

if (boilerplateIndexNode !== null) {
boilerplateIndexNode.assignVariable(config.polyfill, 'true');

if (config.ieTags) {
boilerplateIndexNode.assignVariable('ieTags', true);
}

if (config.ga) {
boilerplateIndexNode.assignVariable('googleAnalytics', true);
}

if (config.ga_siteId) {
boilerplateIndexNode.assignVariable('googleAnalyticsSiteID', config.ga_siteId);
}
}

return true;
};
Loading

0 comments on commit c565a67

Please sign in to comment.