Skip to content

Instantly share code, notes, and snippets.

@xfry
Last active August 29, 2015 14:21
Show Gist options
  • Save xfry/668cb839274807fc0283 to your computer and use it in GitHub Desktop.
Save xfry/668cb839274807fc0283 to your computer and use it in GitHub Desktop.
Reading you-don't-know-js from Harpjs at localhost

##introduction If you have a good internet conection maybe you don't need do this, but if like me you have internet issues then this steps should be a good option to read YDKJS aka You Don't Know JS at localhost usign Harpjs like markdown compiler.

###Installing Harpjs First you need a way to compile markdown template, I'm using Harpjs because is so easy to understand the basic to run an static site. Then open a terminal and write the next commands.

  • sudo npm install -g harp
  • create file directory mkdir mybook and go inside it cd mybook
  • create default boilerplate files from harp harp init
  • clone You Don't Know JS github repository git clone git@github.com:getify/You-Dont-Know-JS.git inside myblog directory

So far you should see a list of files like this: _layout.jade, index.jade, main.less and the github repository You Don't Know JS github repository

###Compiling markdown to html The final step is get the github-markdown.css style and setting it.

  • download github-markdown.css sudo npm install --save github-markdown-css
  • copy the css file to the root directory cp node_modules/github-markdown-css /mybook
  • open _layout.jade file and paste this line link(rel="stylesheet" href="/github-markdown.css") below main.css then add below of the body tag the next code article.markdown-body remember keep the tag indentation space for .jade files and insert != yield below of article.markdown-body
  • open the main.less file and paste this code at the end of the file:
.markdown-body {
  min-width: 200px;
  max-width: 790px;
  margin: 0 auto;
  padding: 30px;
}

###Testing the book content Finally we just want to test the book with markdown format.

  • open the terminal and go inside the mybook directory
  • write the harp command: harp compile if any error happen you are make the steps very good!
  • and finally run the server harp server this show to you where to find the book at localhost:9000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment