{"id":24983667,"url":"https://github.com/posthtml/posthtml-mixins","last_synced_at":"2025-06-16T21:38:51.768Z","repository":{"id":57328826,"uuid":"73558501","full_name":"posthtml/posthtml-mixins","owner":"posthtml","description":"📮 Mixins allow you to create reusable blocks of code.","archived":false,"fork":false,"pushed_at":"2017-05-04T17:27:17.000Z","size":36,"stargazers_count":5,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T20:04:06.320Z","etag":null,"topics":["mixins","posthtml","posthtml-mixins"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/posthtml.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}},"created_at":"2016-11-12T14:48:39.000Z","updated_at":"2019-12-05T06:16:40.000Z","dependencies_parsed_at":"2022-09-07T16:30:26.925Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-mixins","commit_stats":null,"previous_names":["mrmlnc/posthtml-mixins"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/posthtml/posthtml-mixins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-mixins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-mixins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-mixins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-mixins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-mixins/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-mixins/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260246280,"owners_count":22980368,"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":["mixins","posthtml","posthtml-mixins"],"created_at":"2025-02-04T09:20:16.154Z","updated_at":"2025-06-16T21:38:51.733Z","avatar_url":"https://github.com/posthtml.png","language":"TypeScript","readme":"# posthtml-mixins\n\n\u003e A [PostHTML](https://github.com/posthtml/posthtml) plugin adds support for Mixins. Mixins allow you to create reusable blocks of code.\n\n[![Travis Status](https://travis-ci.org/mrmlnc/posthtml-mixins.svg?branch=master)](https://travis-ci.org/mrmlnc/posthtml-mixins)\n\n## Install\n\n```\n$ npm i -D posthtml-mixins\n```\n\n## Usage\n\n```js\nconst { readFileSync } = require('fs');\n\nconst posthtml = require('posthtml');\nconst mixins = require('posthtml-mixins');\n\nconst html = readFileSync('index.html');\nposthtml([ mixins() ])\n  .process(html)\n  .then((result) =\u003e console.log(result.html))\n```\n\n## Options\n\n#### delimiters\n\n  * Type: `String[]`\n  * Default: `['{{', '}}']`\n\nArray containing beginning and ending delimiters for locals.\n\nFor example:\n\n  * `['{', '}']` - `{ key }`\n  * `['${', '}']` - `${ key }`\n  * `['%', '%']` - `%key%`\n  * `['%', '']` - `%key`\n\n## Features\n\n### Parameters\n\nWe support parameters for Mixins inside tags and in attributes.\n\n```html\n\u003cmixin name=\"say\" class from\u003e\n  \u003cp class=\"{{ class }}\"\u003eHello from {{ from }}!\u003c/p\u003e\n\u003c/mixin\u003e\n\n\u003cdiv\u003e\n  \u003cmixin name=\"say\" class=\"hello\" from=\"me\"\u003e\u003c/mixin\u003e\n\u003c/div\u003e\n```\n\n```html\n\u003cdiv\u003e\n  \u003cp class=\"hello\"\u003eHello from me!\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Default values\n\nWe support default values for parameters (order is unimportant).\n\n```html\n\u003cmixin name=\"say\" class from=\"me\"\u003e\n  \u003cp class=\"{{ class }}\"\u003eHello from {{ from }}!\u003c/p\u003e\n\u003c/mixin\u003e\n\n\u003cdiv\u003e\n  \u003cmixin name=\"say\" class=\"hello\"\u003e\u003c/mixin\u003e\n\u003c/div\u003e\n```\n\n```html\n\u003cdiv\u003e\n  \u003cp class=\"hello\"\u003eHello from me!\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Mixin reloading\n\nWe support Mixin reloading when the Mixin may have the same name but a different number of parameters.\n\n```html\n\u003cmixin name=\"say\" from\u003e\n  \u003cp\u003eHello from {{ from }}!\u003c/p\u003e\n\u003c/mixin\u003e\n\n\u003cmixin name=\"say\"\u003e\n  \u003cp\u003eHello!\u003c/p\u003e\n\u003c/mixin\u003e\n\n\u003cdiv\u003e\n  \u003cmixin name=\"say\"\u003e\u003c/mixin\u003e\n\u003c/div\u003e\n\n\u003cdiv\u003e\n  \u003cmixin name=\"say\" from=\"mixin\"\u003e\u003c/mixin\u003e\n\u003c/div\u003e\n```\n\n```html\n\u003cdiv\u003e\n  \u003cp\u003eHello!\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv\u003e\n  \u003cp\u003eHello from mixin!\u003c/p\u003e\n\u003c/div\u003e\n```\n\n## Changelog\n\nSee the [Releases section of our GitHub project](https://github.com/mrmlnc/posthtml-mixins/releases) for changelogs for each release version.\n\n## License\n\nThis software is released under the terms of the MIT license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-mixins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-mixins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-mixins/lists"}