extends ../templates/main
block header
include ../includes/header
:markdown## Jade+Stylus+Grunt = amazing.block mainContent
pbutton#theme Switch to Light
:markdownNode.JS provides a powerful platform for programming the generation of static HTML files.This site is the result of an example build system.#### [Source Code Birds-eye](./docs/source-code/)#featuresh3 Features
#current+includeMarkdown('src/markup/htdocs/docs/features.markdown')
#planned+includeMarkdown('src/markup/htdocs/docs/addendum.markdown')
//-MODERNIZR / YEPNOPE SCRIPT LOADINGJade currently doesn't wrap included JS files properly,so we have to do so manually with unescaped function output.+includeJs('yepnope')
varmarked=require('marked');module.exports=function(grunt){// Grunt loaded for utilities; do not configure here. // Reading from configuration may not work either,// unless done at task runtime; e.g. in a function.var_=grunt.util._;varjadeLocals={};///////////////////////////////////////////////////////////////////////////////////////// Expose grunt & _ to Jade.//// Done this way because grunt.log / grunt.verbose "or" functionality blows the stack// when attempting to simply `jadeLocals.grunt = grunt`//// Also, I would not advocate getting too complicated in template logic.// Most template scripts should be wrapped up as helper functions here,// rather than calling grunt directly from the template.//// Still, `!= grunt.file.read('relative/to/gruntfile.js')`// provides an awesome way for variable includes with absolute (project) paths,// and `grunt.task.current.name` may be handy.////// _ + _.str just makes sense./////////////////////////////////////////////////////////////////////////////////////////vargruntOmissions=['log','verbose'];vargruntLogExports=['write','writeln','error','errorlns','ok','oklns','subhead','writeflags','debug'];jadeLocals.grunt=_.omit(grunt,gruntOmissions);jadeLocals.grunt.log=_.pick(grunt.log,gruntLogExports);jadeLocals.grunt.verbose=_.pick(grunt.verbose,gruntLogExports);jadeLocals._=_;jadeLocals.includeJs=function(name){if(!_.isString(name)||!name){grunt.log.error('No script name included.');return;}functionwrapScript(js){js=_.isString(js)&&js||'';return['<script type="text/javascript">',js,'</script>'].join('\n');}varbuild=grunt.config('build'),piece=(_.isString(build)&&build!='default')?'.'+build:'';varbaseDir='src/markup/includes/scripts/',scriptPath=[baseDir,name,piece,'.js'].join(''),script=grunt.file.read(scriptPath);// will fail task on errorreturnwrapScript(script);};jadeLocals.includeMarkdown=function(markdownPath){marked.setOptions({smartLists:true});markdownPath=markdownPath||grunt.config('markdownPath');varsrc=markdownPath&&_.isString(markdownPath)&&grunt.file.read(markdownPath),output=src&&marked(src);returnoutput||'';};grunt.verbose.subhead('Loading Jade Locals module...').ok().writeln('Exports:');grunt.verbose.oklns(_.keys(jadeLocals).join('\n'));returnjadeLocals;};
//////////////////////////////////////////////////////////////////////////////////// ## Grunt Build Notes// ### Main front-end script loader. Should be included inline in HTML.//// The Jade helper file, `src/scripts/jade/helpers/jade_locals.js`,// exposes a `scriptLoader` function that returns script injecting JavaScript// read from the filesystem.// // The Jade include, `src/markup/includes/endScripts.jade`,// calls `scriptLoader()` and wraps the unescaped return value// in a `<script type="text/javascript"> tag.//// The `scriptLoader` function can be modified in the helper file// to include different JavaScript based on the build.//// ## Script Notes// // Development convenience script loader.//// ### jQuery//// Checks for online status, then attempts to download jQuery via CDN.// Then, it checks for jQuery and falls back to a local copy.//// ### Scripts// // Loads individual site scipts. Logs complete message.//////////////////////////////////////////////////////////////////////////////////window.yepnope.complete=yepnope.complete||function(){};yepnope([{// ### jQuery (CDN)test:!window.jQuery&&window.navigator&&navigator.onLine,yep:'//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js',complete:function(){yepnope({// ### jQuery (local fallback)test:!window.jQuery,yep:'/assets/scripts/vendor/jquery.min.js'});}},{// ### Scriptsload:['/assets/scripts/main.js'],complete:function(){window.console&&console.log&&console.log('All scripts loaded.');window.yepnope.complete();window.yepnope.COMPLETED=true;}}]);
//////////////////////////////////////////////////////////////////////////////////// ## Grunt Build Notes// ### Main front-end script loader. Should be included inline in HTML.//// The Jade helper file, `src/scripts/jade/helpers/jade_locals.js`,// exposes a `includeJS` function that returns script injecting JavaScript// read from the filesystem, based on the build configuration.// // The Jade include, `src/markup/includes/endScripts.jade`,// uses the unescaped return value of `includeJs('yepnope')`////// ## Script Notes// // Development convenience script loader.//// ### jQuery//// Checks for online status, then attempts to download jQuery via CDN.// Then, it checks for jQuery and falls back to a local copy.//// ### Main Script// // Loads site payload. Logs complete message.//////////////////////////////////////////////////////////////////////////////////window.yepnope.complete=yepnope.complete||function(){};yepnope([{// ### jQuery (CDN)test:!window.jQuery&&window.navigator&&navigator.onLine,yep:'//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js',complete:function(){yepnope({// ### jQuery (local fallback)test:!window.jQuery,yep:'/assets/scripts/vendor/jquery.min.js'});}},{// ## Main Scriptload:['/assets/scripts/main.min.js'],complete:function(){window.console&&console.log&&console.log('All scripts loaded.');yepnope.complete();}}]);
;(function($,window,undefined){window.console&&console.log('Welcome to main.js.');var$body=$('body'),$button=$('#theme'),dark=$button.text(),light=dark.replace('Light','Dark');functiontoggleTheme(){$body.toggleClass('light dark');vartext=$body.hasClass('light')?light:dark;$button.text(text);}window.toggleTheme=toggleTheme;functionbindButton(){$body.addClass('dark');$button.click(toggleTheme);}$(bindButton);})(jQuery,this);