ssc

A simple static website compiler

How to Run

Make sure to run the ssc command from the root directory of your project. (Install via npm)

  • Add a @link directive that links to a desired resource
  • When processing links, a '~' will get replaced by the root directory
  • Implement active states for the nav element
  • Fix title bug
  • Comments (Disqus)
  • Meta Data about pages (Title, author, date, tags, desired_url)
  • Grunt (to start)
  • Mark various links as active or not (Headers)

We need a differencing name for importing and placing.

  • Partials: @partial Is a chunk of code that gets imported into a page. If you do not specify an ID the name of the file will be used
  • Layout: @layout These are used to define the structure of a page. Automatically set by the folder, can be overwritten
  • Placing: @place Used in conjunction with @layout to place the content of a page. Automatically set by the folder, can be overwritten
  • Templates: Are handled by mustache {{}}. Every file is processed for these before being compiled
  • Link: @link If you are uncertain of a link path, you can use and let the compiler take care of it

Data: Is meta data of the file. It will get parsed out and tagged on to the file's object

  • Import: Anything withing these tags will get executed during the processing step. The scope will be the file object

Pages and Posts should live in the same list, you just filter them to get what you want

Assumptions:

  • Reading in a folder gives a default layout to all files within the folder. If the folder ends in 's/' (ie: anything plural) the trailing 's/' will be removed. For example, the 'posts/' folder will give a default layout of 'post'
  • Using Mustache.js for templates
  • Using less for css (or plain css)
  • All css / less will be compiled into one file as "styles.css". It will be available in 'css/styles.css'
  • The assets folder will be copied over untouched to the public folder
  • All folders will end in a / except the root folder ???

Reading Step

  1. settings file
  2. layouts folder
  3. posts folder
  4. pages folder
  5. partials folder

Import Step

  1. Loop through the layouts and load in their @partials
  2. Loop through the posts and compile them bases on the post tmpl (or another if specified)
  3. Loop through the pages and compile them bases on the pages tmpl (or another if specified) Process their imports if they have any
  4. Process the index file for templates and imports

Compilation Step

Output Step

Starting from the 'scripts/' folder

  • sitePathAbs: '/kaw2k.github.com/', Not sure why we need quite yet...
  • sitePathRel: '../../kaw2k.github.com/', Need to give a starting point to output all the files
  • rootPathRel: '../' Need to translate from the script folder location to the rest of the project
  • rootPathAbs:

Post Objects

  • id: unique identifier, defaults to [name]
  • rawName: The full file name 'test.md'
  • name: The trimmed name 'test'
  • extension: The trimmed extension 'md'
  • rawFile: A saved veresion of the raw file
  • file: The file as it gets processed
  • layout: Defaults to index if not specified by the file
  • title: The title of the post
  • date: The date of the post
  • tags: Any tags the post may have
  • urlName: The last part of the url, no extension, defaults to [name]
  • urlPath: What folder you want the file to live in defaults to passed in path