verekia / initializr

HTML5 Boilerplate Build Tool
http://initializr.com
1.44k stars 238 forks source link

Initializr - Documentation

Download or Print

The idea of Initializr API is pretty simple. You can either download an archive or display its content. Just ping this URL to get an archive of Initializr:

http://www.initializr.com/builder

Please note that the content of this particular archive is not relevant because no "module" have been added to it, but you'll understand that in a minute.

If you add a ?print parameter, it will display the content of the archive without downloading it:

http://www.initializr.com/builder?print

Modules

Initializr uses "modules", which are code snippets or files (or both) that will be included in the archive.

The modernizr module, for instance, adds the following line in index.html:

\<script src="js/libs/modernizr-2.0.min.js">\</script>

and also adds modernizr-2.0.min.js in the js/libs directory.

If you want to add a module to your archive, just add the name of that module as a GET parameter:

http://www.initializr.com/builder?print&jquery&modernizr

All the current available modules can be found on this Github.

How a module is defined

Let's take a look at what contains modules/modernizr on the Git repo:

{
    "author" : "Paul Irish",
    "name" : "Modernizr",
    "id" : "modernizr",
    "inserts" :
    [
        {
            "what" : "modernizr.html",
            "where" : "index.html/head/html5polyfill"
        }
    ,
        {
            "what" : "modernizr-2.0.min.js",
            "where" : "js/libs/modernizr-2.0.min.js",
            "type" : "file"
        }
    ],
    "incompatibilities" : ["html5shiv"]
}

We can see that a module configuration file is actually a simple JSON containing the following members: