Giter Club home page Giter Club logo

firede / docpad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from docpad/docpad

1.0 1.0 0.0 282 KB

DocPad is the easiest way to create your static website. You have the power of a CMS and simplicity of a notepad. Write your website in the markup of your choice (Markdown, HTML, Jade?), in the editor of your choice (Textmate, Sublime, Notepad?), and deploy anywhere (FTP, Git, localhost?). Total control, total simplicity.

CoffeeScript 100.00%

docpad's Introduction

DocPad: It's Like Jekyll.

DocPad (like Jekyll) is a static website generator, unlike Jekyll it's written in CoffeeScript+Node.js instead of Ruby, and also allows the template engine complete access to the document model. This means you have unlimited power as a CMS and the simplicity of a notepad.

Huh?

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

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

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

       <html>
       	<head><title><%[email protected]%></title></head>
       	<body>
       		<%-@content%>
       	</body>
       </html>
    • And a layout at src/layouts/post.html, which contains:

       ---
       layout: default
       ---
       <h1><%[email protected]%></h1>
       <div><%-@content%></div>
    • And a document at src/documents/posts/hello.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/files will be copied to the out directory. E.g. src/files/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 we use is Eco which allows you to do some pretty nifty things. In fact we can display the all titles and links of our posts with the following html:

       <% 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 (i.e. it had the .md extension). Markdown is a great markup language as with it you have an extremely simple and readable document which generates a rich semantic HTML document. DocPad also supports a series of other markup languages which are listed later on.

Installing

  1. Install Node.js

  2. Install CoffeeScript

     npm -g install coffee-script
    
  3. Install DocPad

     npm -g install docpad
    

Using

  • To generate the rendered website, watch the files for changes, and run the docpad server

      docpad
    
  • To generate a basic website structure in the current working directory

      docpad skeleton
    
  • 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
    

Created With

General

Markup Languges

Template Engines

  • Eco - Templating Made Easy

Learning

To learn more about DocPad (including using and extending it) visit its wiki here

History

  • 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

License

Licensed under the MIT License Copyright 2011 Benjamin Arthur Lupton

docpad's People

Contributors

balupton avatar

Stargazers

Zhao Lei avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.