Coder Social home page Coder Social logo

templette's Introduction

Templette 0.5.2

A Ruby static HTML templating gem.

Why?

Templette was created to make it easy to create and maintain static websites.

It provides a (hopefully) simple structure of pages, templates and helpers.

Templates are the universal page layouts.

Pages are the unique content of a page.

Use me

Use templette <site-name> to generate the framework basics.

rake build

Generates the full documents in an ‘out’ folder in the site root.

For more information on available rake tasks, check out FileGenerator.

For more info on creating pages, look at Templette::Page.

Haml or ERB

Template rendering supports multiple rendering engines now, with one or two more to arrive shortly.

Simply name templates with their rendering engine name as the final file extension. Like ‘template.html.haml`. More details are in Templette::Template.

Now the internal html snippets can be rendered from erb or haml as well. This is handy if you prefer to maintain your markup as haml, or if you have parts of your site that could be DRYer. Instead of specifying a file as ‘file:text.html`, now you can write `render text.html.haml`.

Helper support

Automate content and avoid having to update transient information.

By default, a helper will automatically load a helper that shares its name.

Any methods loaded in the helper will be available to the template at build time.

Definable site root

A subdirectory can be set as the project root. Generated page and resource directories will be built into a given subdirectory. An example can be found in the config.rb file generated in new projects, or by running rake generate:config.

Standard tag methods

Rendered html now supports ‘image_tag`, `stylesheet_tag` and `script_tag`. These methods will recognize a site root, as described above, and build links accordingly. Documentation on the individual methods is in Templette::Helpers.

Site resources

Additional resources for a site such as css and images can be managed and built into the site using the resources directory. All files within the resources dir get copied into your output directory upon build.

Preview

Run rake preview to see your project in a web browser. The preview task will build your project in a temporary ‘preview’ directory. WEBrick will boot and serve your project up on localhost:4444.

templette's People

Contributors

jdunphy avatar sholder avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.