tremolite_example

tremolite_example

This is example static page created by tremolite

Step by step

  1. Create empty Crystal project:

crystal init app tremolite_example

  1. Add tremolite shard to shard.yml:
dependencies:
  tremolite:
    github: akwiatkowski/tremolite
  1. Create /data directory:

mkdir data

  1. Create /data/config.yml file with default data:
site.title: Tremolite Example
site.desc: "An example static page created by tremolite engine"
site.email: hello@example.com
site.url: "https://github.com/akwiatkowski/tremolite"
site.author: Aleksander Kwiatkowski
  1. Create /data/assets and /data/images directory.

mkdir data/assets mkdir data/images

  1. Prepare to override Tremolite::Renderer#render_all:
  • Create /data/src/renderer.cr file
  • Create /data/src/blog.cr and include renderer require "./renderer"
  1. Override Tremolite::Renderer#render_all:
class Tremolite::Renderer
  def render_all
    render_index
  end

  def render_index
    view = HomeView.new(blog: @blog, url: "/")
    write_output(view)
  end
end
  1. Create HomeView:
class HomeView < Tremolite::Views::BaseView
  def initialize(@blog : Tremolite::Blog, @url = "/")
  end

  getter :url

  def title
    @blog.data_manager.not_nil!["site.title"]
  end

  def output
    return "<h1>Hello</h1>"
  end

end

Don't forget to require it require "./views/home_view" in /data/src/renderer.cr.

  1. Run as explained below :)

shards build tremolite_example ./bin/tremolite_example

Usage

This is the shortest "how to start". tremolite is intended to be faster and much more customizable static site generator for my personal blog which is the purpose I've started tremolite project.

The project is under (not so heavy) development. It's not ready and not sure when it will be. There is massive lack of documentation. It will be developed in the same time I spent time on my blog.

Development

TODO: Write development instructions here

Contributing

  1. Fork it ( https://github.com/akwiatkowski/tremolite_example/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

tremolite_example

Owner
Statistic
  • 2
  • 1
  • 0
  • 0
  • 1
  • almost 8 years ago
  • March 11, 2017
License

MIT License

Links
Synced at

Sat, 21 Dec 2024 16:00:17 GMT

Languages