tremolite_example
tremolite_example
This is example static page created by tremolite
Step by step
- Create empty Crystal project:
crystal init app tremolite_example
- Add
tremolite
shard toshard.yml
:
dependencies:
tremolite:
github: akwiatkowski/tremolite
- Create
/data
directory:
mkdir data
- 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
- Create
/data/assets
and/data/images
directory.
mkdir data/assets
mkdir data/images
- Prepare to override
Tremolite::Renderer#render_all
:
- Create
/data/src/renderer.cr
file - Create
/data/src/blog.cr
and include rendererrequire "./renderer"
- 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
- 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
.
- 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
- Fork it ( https://github.com/akwiatkowski/tremolite_example/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- akwiatkowski Aleksander Kwiatkowski - creator, maintainer
tremolite_example
- 2
- 1
- 0
- 0
- 1
- over 7 years ago
- March 11, 2017
MIT License
Fri, 22 Nov 2024 01:08:11 GMT