{"id":13828417,"url":"https://github.com/nochso/html-compress-twig","last_synced_at":"2025-08-23T13:25:48.655Z","repository":{"id":55547953,"uuid":"43705980","full_name":"nochso/html-compress-twig","owner":"nochso","description":"Twig extension for compressing HTML and inline CSS/JS using WyriHaximus/HtmlCompress","archived":false,"fork":false,"pushed_at":"2020-02-08T21:55:17.000Z","size":22,"stargazers_count":80,"open_issues_count":7,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-04T15:30:01.135Z","etag":null,"topics":["composer","compression","minifier","minify","twig","twig-extension"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/nochso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-10-05T18:45:20.000Z","updated_at":"2025-07-09T22:29:47.000Z","dependencies_parsed_at":"2022-08-15T03:00:32.541Z","dependency_job_id":null,"html_url":"https://github.com/nochso/html-compress-twig","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/nochso/html-compress-twig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nochso%2Fhtml-compress-twig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nochso%2Fhtml-compress-twig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nochso%2Fhtml-compress-twig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nochso%2Fhtml-compress-twig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nochso","download_url":"https://codeload.github.com/nochso/html-compress-twig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nochso%2Fhtml-compress-twig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271749048,"owners_count":24814115,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["composer","compression","minifier","minify","twig","twig-extension"],"created_at":"2024-08-04T09:02:45.777Z","updated_at":"2025-08-23T13:25:48.608Z","avatar_url":"https://github.com/nochso.png","language":"PHP","funding_links":[],"categories":["PHP","Twig"],"sub_categories":["Extensions"],"readme":"# nochso/html-compress-twig extension\n\n[![Latest Stable Version](https://poser.pugx.org/nochso/html-compress-twig/v/stable)](https://packagist.org/packages/nochso/html-compress-twig)\n[![License](https://poser.pugx.org/nochso/html-compress-twig/license)](LICENSE)\n[![Build Status](https://travis-ci.org/nochso/html-compress-twig.svg?branch=master)](https://travis-ci.org/nochso/html-compress-twig)\n\nA [Twig](http://twig.sensiolabs.org/) extension for [WyriHaximus/HtmlCompress](https://github.com/WyriHaximus/HtmlCompress).\n\nCurrently supported Twig features are:\n\n* Tag\n    * `{% htmlcompress %} ... {% endhtmlcompress %}`\n* Function\n    * `{{ htmlcompress('some html') }}`\n* Filter\n    * `{{ content|markdown|htmlcompress }}`\n\nAny HTML, inline CSS and Javascript will be compressed.\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [History](#history)\n* [License](#license)\n\n## Installation\n\n1. Install and use [composer](https://getcomposer.org/doc/00-intro.md) in your project.\n2. Require this package via composer:\n\n    ```sh\n    composer require nochso/html-compress-twig\n    ```\n\n## Usage\n\nFirst register the extension with Twig:\n\n```php\n$twig = new Twig_Environment($loader);\n$twig-\u003eaddExtension(new \\nochso\\HtmlCompressTwig\\Extension());\n```\n\nThen use it in your templates:\n\n```\n{% htmlcompress %}{% endhtmlcompress %}\n{{ htmlcompress('\u003cul\u003e \u003cli\u003e') }}\n{{ '\u003cul\u003e \u003cli\u003e'|htmlcompress }}\n```\n\n**Compression is disabled by Twig's `debug` setting.** This is to make development easier, however you can always\noverride it.\n\nThe constructor of this extension takes a boolean parameter `$forceCompression`. When true, this will force compression\n regardless of Twig's `debug` setting. It defaults to false when omitted.\n\n```php\n// Enable compression regardless of Twig's debug setting\n$twig-\u003eaddExtension(new \\nochso\\HtmlCompressTwig\\Extension(true));\n```\n\n## History\nSee [CHANGELOG](CHANGELOG.md) for the full history of changes.\n\n## License\nThis project is licensed under the ISC license which is MIT/GPL compatible and FSF/OSI approved.\nSee the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnochso%2Fhtml-compress-twig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnochso%2Fhtml-compress-twig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnochso%2Fhtml-compress-twig/lists"}