{"id":20214198,"url":"https://github.com/masterminds/engine","last_synced_at":"2025-10-16T02:10:26.452Z","repository":{"id":57602434,"uuid":"41343299","full_name":"Masterminds/engine","owner":"Masterminds","description":"An HTML theme engine for Go","archived":false,"fork":false,"pushed_at":"2017-04-07T15:24:24.000Z","size":45,"stargazers_count":15,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T12:48:02.926Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Masterminds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-25T04:40:44.000Z","updated_at":"2025-03-14T16:08:15.000Z","dependencies_parsed_at":"2022-09-26T20:01:00.824Z","dependency_job_id":null,"html_url":"https://github.com/Masterminds/engine","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Masterminds%2Fengine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Masterminds%2Fengine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Masterminds%2Fengine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Masterminds%2Fengine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Masterminds","download_url":"https://codeload.github.com/Masterminds/engine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248232225,"owners_count":21069486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T06:14:32.010Z","updated_at":"2025-10-16T02:10:21.401Z","avatar_url":"https://github.com/Masterminds.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Engine: A Web Theme Engine for Go\n[![Stability:\nExperimental](https://masterminds.github.io/stability/experimental.svg)](https://masterminds.github.io/stability/experimental.html)\n[![Build Status](https://travis-ci.org/Masterminds/engine.svg)](https://travis-ci.org/Masterminds/engine) [![GoDoc](https://godoc.org/github.com/Masterminds/engine?status.png)](https://godoc.org/github.com/Masterminds/engine) [![Go Report Card](http://goreportcard.com/badge/Masterminds/engine)](http://goreportcard.com/report/Masterminds/engine)\n\nThis library provides tools for managing themes (a collection of\ntemplates and supporting files) for Go. It allows theme chaining\nand overriding.\n\nThis library is oriented toward Web theming using `html/template`\nand `text/template`.\n\nWith this library, you can:\n\n- Support numerous themes in one app\n- Cascade and override themes\n- Provide easy support for re-theming an existing app\n\n\n## Usage\n\nSay you have the following theme directories, with the following files:\n\n```\nthemes/\n    |\n    |- pretty/\n    |    |\n    |    |- main.tpl\n    |\n    |- ugly/\n    |    |\n    |    |- duckling.tpl\n    |    |\n    |    |- main.css\n    |\n    |- default/\n         |\n         |- main.tpl\n         |\n         |- duckling.tpl\n         |\n         |- main.css\n```\n\nThere are three themes here: `themes/pretty`, `themes/ugly`, and\n`themes/default`.\n\nThere are two types of file: templates (end in `.tpl`) and assets (don't\nend in `.tpl`).\n\nSay we want to apply the pretty theme, but with a backup to the default\ntheme. We never want any ugly theme content.\n\n```go\npackage main\n\nimport \"github.com/Masterminds/engine\"\n\nfunc main() {\n    engine, err := New(\"themes/pretty\", \"themes/default\")\n    if err != nil {\n        // ... handle the error\n    }\n\n    // Render the main.tpl, passing the template the data 42.\n    // Because of the order of directories passed into New, this will\n    // render to `pretty/main.tpl`.\n    out, err := e.Render(\"main.tpl\", 42)\n    // ... out will have the rendered data.\n\n    // This will use `themes/default/duckling.tpl` because there is no\n    // duckling.tpl in the `themes/pretty` directory.\n    out, err = e.Render(\"duckling.tpl\", 42)\n\n    // This will find the `main.css` in the `themes/default` folder,\n    // since none exists in `themes/pretty`\n    path, err := e.Asset(\"main.css\")\n}\n```\n\nIn the example above, not that we load two of the three available\ntemplates. Engine's primary roll, then, is to negotiate which theme\nshould be used for each individual render call.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasterminds%2Fengine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasterminds%2Fengine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasterminds%2Fengine/lists"}