Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

H5BP Markup-based page-specific code execution /w Hooks

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 css
Octocat-spinner-32 js
Octocat-spinner-32 README.md
Octocat-spinner-32 about.html
Octocat-spinner-32 index.html
README.md

H5BP Markup-based page-specific code execution

Bit of a mouthful I know, but hopefully you will like the end results. ^_^

The aim of this project is to provide a means to execute page specific javascript that is stored in separate files whilst in development and then minified into one file for use on production servers.

I use the DOM-ready execution method as laid out by (paulirish) here http://paulirish.com/2009/markup-based-unobtrusive-comprehensive-dom-ready-execution/ After a while of using this though I found my script.js file got really big and hard to read. I needed a way to split the page specific code up into separate files whilst in development and then minified back to one file when placed on the production server.

This is where the script comes in but I figured I would try and make it as a library so it can be extended with more useful features.

Example

Not much to look at I know...

Built in hooks

There are many ways this could be achieved but I decided to try and implement the Hooks / Filter system like what Wordpress has as I like the idea of being able to hook into events that happen on a page.

I started thinking up this approach for an ecommerce site we was making and I wanted a separate 'module' that would be able to add its own page specific code and hook onto events that were already taking place.

As an example, if we add a product to the basket we would do this by AJAX without the page refreshing. If we could then have a separate 'View Basket' module that we include onto a page, this could hook onto the 'product-added' event and then refresh the page totals automaticaly.

Going forward

The next steps would be to hopefully get some feedback on the idea and see if there is anything that could be improved / extended or merged into this project.

Other things to note

... test edit with TortoiseGit

Something went wrong with that request. Please try again.