DocPad. It makes web development intuitive again.
CoffeeScript Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 114 commits ahead, 1286 commits behind docpad:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.gitignore
README.md
package.json

README.md

DocPad. It makes web development intuitive again.

Initially web development was pretty easy, you just wrote a bunch of files and you got your website. These days, it's a lot more complicated than that. Things like databases, synchronisation, legacy frameworks and languages all slow the entire process down into a painful crawl. It doesn't have to be like that.

DocPad takes that good ol' simple approach of writing files and wraps it with the most awesome new innovations providing a new intuitive solution for developing websites in this new HTML5 era.

Let's take a look

  1. Say you were to create the following website structure:

    • myWebsite - src - documents - layouts - public
  2. And you were to create the following files:

    • A layout at src/layouts/default.html.eco, which contains

       <html>
       	<head><title><%=@Document.title%></title></head>
       	<body>
       		<%-@content%>
       	</body>
       </html>
    • And another layout at src/layouts/post.html.eco, which contains:

       ---
       layout: default
       ---
       <h1><%=@Document.title%></h1>
       <div><%-@content%></div>
    • And a document at src/documents/posts/hello.html.md, which contains:

       ---
       layout: post
       title: Hello World!
       ---
       Hello **World!**
  3. Then when you generate your website with docpad you will get a html file at out/posts/hello.html, which contains:

    <html>
    	<head><title>Hello World!</title></head>
    	<body>
    		<h1>Hello World!</h1>
    		<div>Hello <strong>World!</strong></div>
    	</body>
    </html>
  4. And any files that you have in src/public will be copied to the out directory. E.g. src/public/styles/style.css -> out/styles/style.css

  5. Allowing you to easily generate a website which only changes (and automatically updates) when a document changes (which when you think about it; is the majority of websites)

  6. Cool, now what was with the <%=...%> and <%-...%> parts which were substituted away?

    • This is possible because we parse the documents and layouts through a template rendering engine. The template rendering engine used in this example was Eco (hence the .eco extensions of the layouts). Templating engines allows you to do some pretty nifty things, in fact we could display all the titles and links of our posts with the following:

       <% for Document in @Documents: %>
       	<% if Document.url.indexOf('/posts') is 0: %>
       		<a href="<%= Document.url %>"><%= Document.title %></a><br/>
       	<% end %>
       <% end %>
  7. Cool that makes sense... now how did Hello **World!** in our document get converted into Hello <strong>World!</strong>?

    • That was possible as that file was a Markdown file (hence the .md extension it had). Markdown is fantastic for working with text based documents, as it really allows you to focus in on your content instead of the syntax for formatting the document!

Installing

  1. Install Node.js

  2. Install dependencies

     npm -g install coffee-script
    
  3. Install DocPad

     npm -g install docpad
    
  4. or... install the cutting edge version

     git clone git://github.com/balupton/docpad.git
     cd docpad
     git branch -v
     npm install
     git submodule init
     git submodule update
     npm link
    

Using

  • Firstly, make a directory for your new website and cd into it

      mkdir my-new-website
      cd my-new-website
    
  • To get started, simply run the following - it will run all the other commands at once

      docpad run
    
  • To generate a basic website structure in the current working directory if we don't already have one

      docpad scaffold
    
  • To regenerate the rendered website

      docpad generate
    
  • To regenerate the rendered website automatically whenever we make a change to a file

      docpad watch
    
  • To run the docpad server which allows you to access the generated website in a web browser

      docpad server
    

Supports

Markups

  • Markdown to HTML .html.md|markdown
  • Eco to anything .anything.eco
  • CoffeeKup to anything .anything.ck|coffeekup|coffee and HTML to CoffeeKup .ck|coffeekup|coffee.html
  • Jade to anything .anything.jade and HTML to Jade .jade.html
  • HAML to anything .anything.haml

Styles

  • Stylus to CSS .css.styl|stylus
  • CoffeeCSS to CSS .css.ccss|coffeecss|coffee

Scripts

  • CoffeeScript to JavaScript .js.coffee and JavaScript to CoffeeScript .coffee.js

Parsers

About

DocPad is getting pretty popular these days... you can check out a bunch of websites already using it here, and discover the awesomely handsome crew behind the community here. Ocassionally we also hold events and competitions where you can learn more about docpad, hack with others together, and win some cool stuff! Nifty.

On that note, DocPad is awesomely extensible. You can download other people's plugins and use them in real quick, or even write your own in matters of minutes.

Best yet, definitely check out the entire wiki, as this has just been a small taste of it's awesomeness, and there is plenty awesomness left to be discovered.

Thanks. DocPad loves you.

History

  • v1.3 October 3, 2011

    • Parsing is now split into two parts parsing and contextualizing
      • Contextualizing is used to determine the result filename, and title if title was not set
    • The code is now more concise
      • File class moved to lib/file.coffee
      • Prototypes moved to lib/prototypes.coffee
      • Version checking moved to bal-util
    • File properties have changed
      • basename is extensionless
      • filename now contains the file's extnesions
      • id is now the relativeBase instead of the slug
      • extensionRendered is the result extension
      • filenameRendered is the result filename: `"#{basename}.#{extensionRendered}"
      • title if now set to filenameRendered if not set
    • Added support for different meta parsers, starting with CoffeeScript and YAML support. YAML is still the default meta parser.
    • The YAML dependency is specifically set now to v0.2.1 as the newer version has a bug in it.
    • Fixed multiple renderers for a single document. E.g. file.html.md.eco
    • Now also supports using ### along with --- for wrapping the meta data
    • Supports the public alias for the files directory
  • v1.2 September 29, 2011

  • v1.1 September 28, 2011

    • Added Buildr Plugin so you can now bundle your scripts and styles together :-)
    • The action method now supports an optional callback
    • Added a try..catch around the version detection to ensure it never kills docpad if something goes wrong
    • Skeletons have been removed from the repository due to circular references. The chosen skeleton is now pulled during the skeleton action. We also now perform a recursive git submodule init and update, as well as a npm install if necessary.
  • v1.0 September 20, 2011

  • v0.10 September 14, 2011

  • v0.9 July 6, 2011

    • No longer uses MongoDB/Mongoose! We now use Query-Engine which doesn't need any database server :)
    • Watching files now working even better
    • Now supports clean urls :)
  • v0.8 May 23, 2011

    • Now supports mutliple skeletons
    • Structure changes
  • v0.7 May 20, 2011

    • Now supports multiple docpad instances
  • v0.6 May 12, 2011

    • Moved to CoffeeScript
    • Removed highlight.js (should be a plugin or client-side feature)
  • v0.5 May 9, 2011

    • Pretty big clean
  • v0.4 May 9, 2011

    • The CLI is now working as documented
  • v0.3 May 7, 2011

    • Got the generation and server going
  • v0.2 March 24, 2011

  • v0.1 March 16, 2011

Thanks

DocPad wouldn't be possible if it wasn't for the following libaries

License

Licensed under the MIT License Copyright 2011 Benjamin Arthur Lupton