{"id":16678435,"url":"https://github.com/pietroalbini/lektor-minify","last_synced_at":"2025-04-09T21:33:43.698Z","repository":{"id":74179699,"uuid":"82607493","full_name":"pietroalbini/lektor-minify","owner":"pietroalbini","description":"Minify build artifacts in a Lektor project","archived":false,"fork":false,"pushed_at":"2019-01-15T10:35:04.000Z","size":36,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T23:27:08.435Z","etag":null,"topics":["lektor","minifier","plugins"],"latest_commit_sha":null,"homepage":"","language":"Python","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/pietroalbini.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-20T22:05:54.000Z","updated_at":"2020-11-25T17:31:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"37acc2a9-27cb-4d54-af57-9080b8f6181a","html_url":"https://github.com/pietroalbini/lektor-minify","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietroalbini%2Flektor-minify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietroalbini%2Flektor-minify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietroalbini%2Flektor-minify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietroalbini%2Flektor-minify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pietroalbini","download_url":"https://codeload.github.com/pietroalbini/lektor-minify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657270,"owners_count":20974346,"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":["lektor","minifier","plugins"],"created_at":"2024-10-12T13:29:16.661Z","updated_at":"2025-04-09T21:33:43.691Z","avatar_url":"https://github.com/pietroalbini.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lektor-minify\n\n[![Build Status](https://travis-ci.org/pietroalbini/lektor-minify.svg?branch=master)](https://travis-ci.org/pietroalbini/lektor-minify)\n\nThis plugin allows you to minify the build artifacts of your [Lektor][lektor]\nproject during the build process, without any additional tool. It currently\nsupports minifying HTML, CSS and JS files.\n\nThe plugin only minifies the files changed during the last build, avoiding\nslowing down the build if your project consists of a lot of files. Internally\nit uses the [django_htmlmin][htmlmin], [rcssmin][rcssmin] and [rjsmin][rjsmin]\nlibraries, and it's released under the MIT license.\n\n**Supported Lektor releases:** 2.3, 3.0\n\n## Installation\n\nIf you want to use lektor-minify in your project, you can to execute the\nfollowing command in your Lektor project folder:\n\n```\n$ lektor plugins add lektor-minify\n```\n\nAfter you did that, it's good to clear the build cache: the plugin only\nminifies changed files, so clearing the cache ensures all the assets are\nminified:\n\n```\n$ lektor clean --yes\n```\n\n## Usage\n\nThis plugin isn't enabled by default: you need to provide the `minify` flag to\nthe `build` (or `server`) command if you want to minify the build artifacts:\n\n```\n$ lektor build -f minify\n$ lektor server -f minify\n```\n\nIf you need to minify only some kind of artifacts, you can tell which ones you\nwant to minify by providing their kinds as a comma-separated list in the flag:\n\n```\n$ lektor build -f minify:html\n$ lektor build -f minify:html,css,js\n```\n\nKeep in mind only artifacts built with the flag will be minified: if you\nexecute other builds without the flag there might be some unminified files!\n\n## Jinja2 filter\n\nThe plugin also provides the `minify` filter, ready to be used in your\ntemplates. The filter is useful, for example, if you need to include in the\npage external assets, and you want them to be minified as well.\n\nYou can use the filter by piping the content into it, and providing the type of\nthe content as argument:\n\n```\n{{ this.extra_style | minify(\"css\") }}\n```\n\nIf you need to apply the filter to a block of code, you can also use the filter\nblock Jinja2 provides:\n\n```\n\u003cstyle\u003e\n    {% filter minify(\"css\") %}\n        body {\n            color: #fff;\n        }\n    {% endfilter %}\n\u003c/style\u003e\n```\n\nThe filter will work even if the `minify` flag is not provided during the\nbuild.\n\n## Testing\n\nSome basic tests are available for the project. If you want to run them clone\nthe repository, install Lektor and run:\n\n```\nmake test\n```\n\n[lektor]: https://www.getlektor.com/\n[rcssmin]: http://opensource.perlig.de/rcssmin/\n[rjsmin]: http://opensource.perlig.de/rjsmin/\n[htmlmin]: https://github.com/cobrateam/django-htmlmin\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietroalbini%2Flektor-minify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpietroalbini%2Flektor-minify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietroalbini%2Flektor-minify/lists"}