{ "info": { "author": "Cole Krumbholz, Lauri Hynynen", "author_email": "team@brace.io", "bugtrack_url": null, "classifiers": [], "description": "Brace Tags\n==========\n\n> The simplest static site generator\n\nBrace Tags is a static site generator focused on simplicity. It does one thing:\nsolves the problem of having to repeat the same HTML code on several web pages.\n(In other words, it provides \"partials\")\n\nThe template language provided by Brace Tags has only two tags, `include` and\n`is`.\n\n\n## Static site generation 101\n\nYou can use Brace Tags to build a multi-page static website without\nduplicating navigation or footer code. Here's generally how it works:\n\n1. Find duplicated code snippets in your HTML files. Extract them into separate\nfiles called \"partials\".\n\n2. Replace each duplicated code snippet with a special placeholder tag. The tag\nlooks like: `{% include mypartial.html %}`. This is where the content from a\npartial will be injected.\n\n3. Run the `tags build` command to assemble the website from your source code.\nYou can put the generated site online using any static site hosting provider.\n\n\n## An example Brace Tags website\n\nHere's a simple multi-page website with `index.html` and `about.html` files. We\ncan add the main navigation into each page with the `include` tag.\n\nindex.html:\n\n \n
\n {% include nav.html %} \n Welcome to Brace Tags!\n \n \n\n\nabout.html:\n\n \n \n {% include nav.html %}\n Brace Tags is very simple!\n \n \n\nThe `is` tag is used to change the content of a partial based on the file that's\ncurrently being generated. You can use this, for example, to highlight the\ncurrent page in the nav partial.\n\nnav.html:\n\n \n\nNote: you'll need to define CSS styles separately to take advantage of the\n`active` class attribute used above.\n\n## Installing Brace Tags\n\nBrace Tags requires Python. Many computers today come with Python pre-installed,\nincluding all macbooks. If you have Python, you can install Brace Tags with\n`easy_install` by opening up your terminal and typing in:\n\n sudo easy_install brace-tags\n\n(The sudo part will ask you to provide a password. It's required because Brace\nTags needs to install the `tags` command line script.)\n\nBrace has one external dependency, `watchdog` which is only required if you want\nto use Brace to monitor a folder for changes, and recompile your site on the\nfly. Before using the `--watch` option you'll need to install `watchdog` with\n`sudo easy_install watchdog`.\n\n\n## Using Brace Tags\n\nTags has two commands, the `build` command and the `serve` command. Build is\nused to generate a site from a source folder.\n\n tags build\n\nBy default, Brace Tags compiles all the .html files in your site. Tags places\nthe generated site in the `_site` folder, and ignores those files during future\nbuilds. \n\nOnce built, the `serve` command will start a local webserver that you can use\nto view the website locally with your browser. This is for testing only.\n\n tags serve\n\nFor more options and explanation, check out the help:\n\n tags --help\n\n## Hosting your static site\n\nOnce you've generated a static site with Brace Tags, you can deploy it to any\nstatic site host. Github pages and S3 are just a couple of the many options. \n\nOf course we'd love for you host your site with us, on\n[Brace](http://brace.io)!\n\n## Advanced: Extending Brace Tags\n\nIf you're a python programmer, you can add your own tags to implement custom\nfunctionality on top of Brace Tags.\n\nCustom tags should look like this:\n\n {% mytag argument1 argument2 %}\n\nOptionally, a tag can have a body, like this:\n\n {% mytag %}\n Tag Body\n {% endmytag %}\n\nEach time Brace Tags encounters a tag in an input file it checks for a\ncorresponding tag function. If the function exists, it is called and the result\nis substituted in the output.\n\nIn the `/tags/tags.py` file you'll find a function for each template tag. Add\nyour custom tag functions to that file. They should look something like this:\n\n lang = TemplateLanguage()\n\n @lang.add_tag\n def print3x(style, body=u'', context={}):\n ''' A tag that appends 3 copies of its body '''\n result = body + body + body\n if style == \"bold\":\n result = u'' + result + u''\n return result\n\nThe above function creates a print3x tag that can be used like this:\n\n {% print3x bold %}\n