Add grunt.js build script
- Move Bootstrap LESS files into new subdirectory - Change app.css to app.less, add @import's to utilize Bootstrap variables and mixins - Remove plugins.js and main.js - Move Bootstrap JS plugins into new subdirectory - Add new _main.js file with example DOM-based routing script that works off the WordPress body_class - lib/scripts.php has been updated to remove all extra CSS and JS files and also places JavaScript in the footer
This commit is contained in:
46
assets/js/_main.js
Normal file
46
assets/js/_main.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// Modified http://paulirish.com/2009/markup-based-unobtrusive-comprehensive-dom-ready-execution/
|
||||
// Only fires on body class (working off strictly WordPress body_class)
|
||||
|
||||
ExampleSite = {
|
||||
// All pages
|
||||
common: {
|
||||
init: function() {
|
||||
// JS here
|
||||
},
|
||||
finalize: function() { }
|
||||
},
|
||||
// Home page
|
||||
home: {
|
||||
init: function() {
|
||||
// JS here
|
||||
}
|
||||
},
|
||||
// About page
|
||||
about: {
|
||||
init: function() {
|
||||
// JS here
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
UTIL = {
|
||||
fire: function(func, funcname, args) {
|
||||
var namespace = ExampleSite;
|
||||
funcname = (funcname === undefined) ? 'init' : funcname;
|
||||
if (func !== '' && namespace[func] && typeof namespace[func][funcname] === 'function') {
|
||||
namespace[func][funcname](args);
|
||||
}
|
||||
},
|
||||
loadEvents: function() {
|
||||
|
||||
UTIL.fire('common');
|
||||
|
||||
$.each(document.body.className.replace(/-/g, '_').split(/\s+/),function(i,classnm) {
|
||||
UTIL.fire(classnm);
|
||||
});
|
||||
|
||||
UTIL.fire('common', 'finalize');
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(UTIL.loadEvents);
|
||||
Reference in New Issue
Block a user