Package: clay
ClayAn amazing prototyping tool.With Clay you can forget about making changes to dozens of HTML files
just because you need to add a link in the footer.You can also use it to prototype your AJAX-driven application or the
responses of sending forms, because it acts like a real server.Installpip install clayQuickstartclaynewmysitewill generate a new app container with the following structure:mysite
  ├── static/
  ├── clay.yaml
  ├── index.html
  └── ...other filesYou can also use an optional project template path or git URL. For the URLs, "gh:" works as a shortcut of "https://github.com/" and "gl:"  as a shortcut of "https://gitlab.com/". For example:# Absolute or relative path.claynewmyapp/path/to/project/template# GitHub repo. Note the ".git" postfix.claynewmyapphttps://github.com/lucuma/clay-template.git# The same GitHub repo with shortcutclaynewmyappgh:/lucuma/clay-template.gitDevelopment serverInside that folder, run the development server with:clay runand your site'll be available athttp://0.0.0.0:8080/.Anything inside thestaticfolder is served as-is under the/static/path.
For example you can seemyapp/static/image.pngat thehttp://0.0.0.0:8080/static/image.pngURL.Any file outside thestaticfolder, is rendered as a page.For example,myapp/page.htmlis rendered and shown athttp://0.0.0.0:8080/page.html, as an HTML page.Andmyapp/foo/bar.jsonis rendered and shown athttp://0.0.0.0:8080/foo/bar.jsonas a JSON document.Remember to put insidestaticanything you don't want to be rendered.Build versionTo generate a static version of your site, first, stop the server withControl + C, and then run:clay buildand all the templates will be processed and the result stored inside thebuildfolder.Static filesIf you have folders in your project, you might be tempted to write internal URLs like this<!-- DON'T DO THIS ->href="../a.html"
src="../static/main.js"Don't do it. Is error-prone and could not work as expected if you do it in a base layout, for example. Always write the internal URLs using their path from the root of the project, like this:href="/a.html"
src="/static/main.js"That'll work on the development server and also when generating a static version of your site, Clay will convert them into relative paths automatically.Template globalsWhen writing your templates, in addition of what is normally available inJinja templatesyou have access to some other helper functions:The python's functionsdir,enumerate,map,zip, andlen.Thenowfunction, as an alias todatetime.datetime.utcnow.Theactivefunction, to set an "active" class in navigations/menus when the current page match.active()active(*url_patterns,partial=False,class_name="active")TODOTheclay.yamlfileIf a YAML file namedclay.yamlis found in the root of the project, it will be read and used for configuring Clay.---# Shell-style patterns files/folders that must not be copied.# Use quotes.exclude:-".*"-".*/*"-"~*"-"~*/*"-"_*"-"_*/*"-"*.txt"# Shell-style patterns files/folders that *must be* copied, even if# they are in the exclude list.# Use quotes.include:-"robots.txt"-"humans.txt"# Jinja extensions to usejinja_extensions:# Shell-style patterns of files outside `static/` that must be copied# as-is instead of trying to interpret them as Jinja templates.# Use quotes.binaries:-"favicon.ico"Happy coding!