Git Product home page Git Product logo

groom's People

Contributors

volks73 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

groom's Issues

Add support for handlebars in addition to mustache templates

Add support for handlebar templates in addition to mustache templates. The file extension for the input argument would be used to determine the format and which parser/crate is used.

A --template-format option and associated template_format method should be added to override the file extension determination of the template format or provide an indicator when the template has no extension or a different one from handlebar, hbs, or mustache.

Handle data in different formats

Multiple data formats should be supported.

If a data file is specified as an argument to the application, then the file extension should be used to determine the format of the data. For example, if the data file is named "data.yml", then the data will be decoded from the YAML format, but if it is "data.msgpack" then it is decoded from the MessagePack format. Any format that has serde support in Rust should be supported.

A --data-format option and subsequent data_format method should be added as well. This would override the format determined by the file extension or be used to change the default format from YAML to something else if the data is read from stdin or the data file has no extension.

Add built-in basic http server

A basic HTTP server, like this one, should be integrated with groom to locally serve rendered templates. The majority use-case for Mustache (and Handlebar) templates are websites and HTML. It would be nice during development of templates and testing to "host" the website generated from the templates.

A -s,--serve flag or a serve subcommand along with an alternative consuming method to the builder API for the application should be added. This would require renaming the run method to something like render or process and adding serve method that would consume the Groom struct and run the built-in server.

When the --serve flag is issued, groom would render the input template with the specified data and then look for a .html file of the same name as the template to serve. The server would start after rendering and be locally hosted at http://localhost:8080. A -p, --port option would also be added to change the port at run time.

Add file modification listener

A -l,--listen flag or listen subcommand should be added that "listens" for a file to be modified. When a modification is detected, groom re-renders the template. The data would have to be specified in a file for this to work. This would be useful with the serve feature from #3 to automatically refresh a web page after modification.

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.