{"id":25414055,"url":"https://github.com/daiz/htmls","last_synced_at":"2025-04-22T14:26:45.609Z","repository":{"id":13435267,"uuid":"16124327","full_name":"Daiz/htmls","owner":"Daiz","description":"HyperText Markup LiveScript, a Node.js module for HTML/XML templating with LiveScript.","archived":false,"fork":false,"pushed_at":"2023-07-13T11:08:42.000Z","size":264,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T23:04:51.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"LiveScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Daiz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-22T01:03:27.000Z","updated_at":"2024-07-10T00:00:34.000Z","dependencies_parsed_at":"2025-02-16T14:38:38.435Z","dependency_job_id":"73ef3446-8c0d-4f46-b722-196bcacc358b","html_url":"https://github.com/Daiz/htmls","commit_stats":null,"previous_names":["daiz-/htmls"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiz%2Fhtmls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiz%2Fhtmls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiz%2Fhtmls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daiz%2Fhtmls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daiz","download_url":"https://codeload.github.com/Daiz/htmls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250257775,"owners_count":21400796,"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":"2025-02-16T14:35:22.032Z","updated_at":"2025-04-22T14:26:45.581Z","avatar_url":"https://github.com/Daiz.png","language":"LiveScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTMLS - HyperText Markup LiveScript!\n\nInspired by HTML templating engines like [jade](http://jade-lang.com/), I got an idea - *\"Could I make a template engine that uses proper [LiveScript](http://livescript.net) code as templates?\"*\n\nWhat you see here is the outcome of said idea - a functional (HTML5) templating engine that, as originally visioned, uses proper LiveScript code as its templates.\n\n**Word of Warning:** While HTMLS is available on npm, keep in mind that it was something put together in a few hours as a fun exercise. As such, you should probably not use it in any kind of serious production and go with something more stable and mature instead.\n\n## Installation\n\nYou can get HTMLS via npm:\n\n```bash\n$ npm install htmls\n```\n\n## Example\n\n```livescript\ndoctype \\html\nhtml {lang: \\en} -\u003e\n  head -\u003e\n    meta charset: \\utf8\n    title @title\n    meta description: \"A silly experiment in templating\"\n    link rel: \\stylesheet href: \\htmls.css\n    script {type: \"text/javascript\"} \"\"\"\n      if (javascript === \"stinks\") {\n        console.log(\"You should use LiveScript instead!\");\n      }\n    \"\"\"\n  body -\u003e\n    header -\u003e\n      h1 \"HTMLS - HyperText Markup LiveScript!\" \n    main -\u003e\n      if @using-htmls\n        p \"I see that you are using HTMLS. You must be very brave.\"\n      else\n        p \"Maybe you have made a sensible decision after all?\"\n    footer -\u003e\n      $ \"HTMLS, a silly experiment by \"\n      a {href: \"https://github.com/Daiz-/\"} \"Daiz\"\n```\n\nGiven `{title: \"HTMLS\", usingHtmls: true}` as input, this compiles to:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf8\"\u003e\n  \u003ctitle\u003eHTMLS\u003c/title\u003e\n  \u003cmeta description=\"A silly experiment in templating\"\u003e\n  \u003clink rel=\"stylesheet\" href=\"htmls.css\"\u003e\n  \u003cscript type=\"text/javascript\"\u003e\n    if (javascript === \"stinks\") {\n      console.log(\"You should use LiveScript instead!\");\n    }\n  \u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cheader\u003e\n    \u003ch1\u003eHTMLS - HyperText Markup LiveScript!\u003c/h1\u003e\n  \u003c/header\u003e\n  \u003cmain\u003e\n    \u003cp\u003eI see that you are using HTMLS. You must be very brave.\u003c/p\u003e\n  \u003c/main\u003e\n  \u003cfooter\u003e\n    HTMLS, a silly experiment by \u003ca href=\"https://github.com/Daiz-/\"\u003eDaiz\u003c/a\u003e\n  \u003c/footer\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Usage\n\nUsage of HTMLS is quite straightforward. You load the module, you call it with a template string and it spits out a function that you can then use to render said template with any given data. Like so:\n\n```javascript\n// JavaScript\nvar htmls = require('htmls');\nvar templateText = 'p \"Hello, #@!\"';\nvar templateFunc = htmls(templateCode);\nvar html = templateFunc(\"John Smith\"); // \u003cp\u003eHello, John Smith!\u003c/p\u003e \n```\n\n```livescript\n# LiveScript\nrequire! \\htmls\ntemplate-text = 'p \"Hello, #@!\"'\ntemplate-func = htmls template-text\nhtml = template-func \"John Smith\" # \u003cp\u003eHello, John Smith!\u003c/p\u003e\n```\n\n## Writing Templates\n\n- You can only use valid HTML5 element names.\n- It's probably a good idea not to use HTML5 element names as variable names in your templates. Something will likely break.\n- Regular LiveScript may or may play nice inside your templates. Everything should be fine if you stick to stuff like for loops and ifs though, which should be more than enough for basic templating purposes, right?\n- Arguments are accessed via `this` or `@` for short.\n- If you want plain text output inside an element, use the `$` function as seen in the example above.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaiz%2Fhtmls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaiz%2Fhtmls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaiz%2Fhtmls/lists"}