Git Product home page Git Product logo

hot's Introduction

Hot Build Status

Hot is a library for rendering hot golang templates. This means with hot you won't need to reload your application everytime you edit your templates.Hot watches for file changes in your templates directory and reloads everytime you make changes to your files.

hot renders go templates using html/template package.

Installation

go get github.com/gernest/hot

Usage

Just pass the configuration object to hot.New

package main

import (
    "os"

    "github.com/gernest/hot"
)

func main() {
    config := &hot.Config{
        Watch:          true,
        BaseName:       "hot",
        Dir:            "fixtures",
        FilesExtension: []string{".tpl", ".html", ".tmpl"},
    }

    tpl, err := hot.New(config)
    if err != nil {
        panic(err)
    }

    // execute the template named "hello.tpl
    tpl.Execute(os.Stdout, "hello.tpl", nil)
}

Note that the fixtures directory should exist and there is a template file hello.tpl in it , hot will be watching any changes to the files inside this directory.

configuration

The hot.Config object is used to configure the hot template

property details
Watch If set to true, the hot reload is enabled
BaseName Is the root template name, e.g "base", "hot" etc
Dir The directory in which you keep your templates
FilesExtension Supported file extensions. These are the ones parsed in the template.
Funcs (optional) A map of names to functions that can be used inside your templates. (more information)
LeftDelim left template delimiter e.g {{
RightDelim rignt template delimiter e.g }}

Contributing

Start with clicking the star button to make the author and his neighbors happy. Then fork the repository and submit a pull request for whatever change you want to be added to this project.

If you have any questions, just open an issue.

Author

Geofrey Ernest

Twitter : @gernesti

Licence

This project is released under the MIT licence. See LICENCE for more details.

hot's People

Contributors

gernest avatar dkumor avatar msoedov avatar pajlada avatar

Stargazers

Alexfilus avatar Jakob Lorz avatar Frank Hernandez avatar Mateus Lopes avatar Areeb avatar  avatar Toby Padilla avatar  avatar  avatar Karl McGuire avatar Osi Emoekpere avatar xuefeng Huang avatar  avatar  avatar  avatar Sean Hagen avatar Nils avatar  avatar Xu avatar  avatar pi avatar Ernestas Poskus avatar Mehmet Cetin avatar Chris Hart avatar Orkan Alat avatar  avatar Miki Oracle avatar Erkid Hoxholli avatar Fabio Ribeiro avatar Bart avatar  avatar David Nix avatar Konstantin Kanellopoulos avatar Nick Sardo avatar Ewan Jones avatar Philipp Klose avatar Suraj Patil avatar Joseph Lewis III avatar ALex Nikonov avatar metakeule avatar  avatar Gronpipmaster avatar swh avatar Anton Byshovets avatar Vasiliy Bukharev avatar Samuel Dolan avatar Mateusz "Serafin" Gajewski avatar Michael Wagner avatar Michael Hood avatar Brian Ketelsen avatar Luke avatar Nicholas Young avatar  avatar Changsu Jiang avatar Chase Colman avatar Ilya avatar Michael Gardner avatar carlos L avatar  avatar zhengying avatar Rogerio Marques avatar

Watchers

James Cloos avatar  avatar  avatar

hot's Issues

New Files

Right now, if templates are added to the directory during runtime, they are not automatically watched - only files that exist on startup are watched.

This came to my attention when looking at the code, but I didn't explicitly test this, so apologies if I missed something!

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.