Ruthlessly simple static site generator, written in Ruby.
Note that this is designed to be a single file self-contained quick solution. It produces themable Markdown-based static sites as expected, but the codebase (whilst being compact, clear, and commented) is not idiomatic object-oriented Ruby. This is by design, for brevity and simplicity.
- See the changelog for a version history.
Webrick is used for serving the static site locally when creating/updating it, not for production delivery of the result.
You can use the main Ruby site (see link above) installation details, or try RVM, the Ruby Version Manager. On Windows the Ruby+Devkit 2.4.X helps, but be sure to do the full (larger) install when prompted.
Upon running, ruthless will fetch it's own dependencies via Bundler. For this to work, Bundler must already be available:
gem install bundler
- Ensure you have the prerequisites installed (see above).
- Create a folder and drop the
ruthless.rbscript into it.
ruby ruthless.rb --siteto generate a simple site in a new folder (named
ruby ruthless.rbto render a static version of the site.
ruby ruthless.rb --servealso serves the created site.
- The static site will be in a
wwwfolder alongside the
www folder will be replaced (permissions permitting).
Site folder structure
Content is written in Markdown files in a
content folder. Your site structure will mirror the
content folder structure.
Running with the
--site option will create this structure for you, along with some extra files (shown below).
ruthless.rb site/ ruthless.ini layout.liquid theme.css content/ index.md news/ site-launch.md about-the-site.md blog/ how-i-wrote-this-site.md
You can add more content like so:
site/ content/ news/ site-launch.md about-the-site.md blog/ how-i-wrote-this-site.md
site folder should have a
ruthless.ini file with the following options (if you create a new site then a sample one will be provided for you).
[SITE] title = Ruthless blurb = Ruthlessly simple static site generator footer = Created by <a href='https://ruthless.io' target='_blank'>ruthless.io</a> and <a href='https://www.ruby-lang.org' target='_blank'>Ruby</a>. [OPTIONS] extentions = false [MENU] Home = / Latest = /news
The site is rendered using your content, combined with the
layout.liquid template, and the
ruthless.inifile is read in
theme.cssfile is copied over
*.mdfiles and their locations are read in
- They are passed though Red Carpet for fast conversion to HTML
- They are then passed through Liquid for fast templating
- The results are written to matching folders in the output
- Files named
*.txtare also passed through Liquid, but are not treated as Markdown. They will be written inside
- Other file types are copied across unchanged.
Allowed properties in the template
This list is complete, though very small as ruthless is still in progress.
sitetitle- from the
siteblurb- from the
sitefooter- from the
content- the final output from the flow above
By using content front matter (as flat YAML metadata) you can provide any key/value information you like and it will make it's way to the template, with the exception of the ones above which are built in.
--- title: Welcome to Ruthless dated: 2018-08-27 --- For more information, see [the web site](https://ruthless.io).
Debugging in Visual Studio Code
- Add the Ruby extention by Peng Lv
- Install the debugging dependencies:
gem install bundler gem install ruby-debug-ide gem install debase