{"id":16814962,"url":"https://github.com/markstory/mini-asset","last_synced_at":"2025-05-16T05:07:53.608Z","repository":{"id":29906432,"uuid":"33452162","full_name":"markstory/mini-asset","owner":"markstory","description":"A simple set of asset build tools that provides a config file and extensible integrations with pre-processors \u0026 minifiers.","archived":false,"fork":false,"pushed_at":"2025-04-26T03:42:13.000Z","size":1133,"stargazers_count":63,"open_issues_count":5,"forks_count":19,"subscribers_count":5,"default_branch":"2.x","last_synced_at":"2025-04-26T04:26:35.300Z","etag":null,"topics":["asset-builder","asset-pipeline","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/markstory.png","metadata":{"files":{"readme":"README.mdown","changelog":"CHANGELOG.txt","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":"2015-04-05T19:21:31.000Z","updated_at":"2025-04-26T03:30:50.000Z","dependencies_parsed_at":"2023-01-14T15:53:19.819Z","dependency_job_id":"745187bd-674a-4ce8-a88e-e769503efd23","html_url":"https://github.com/markstory/mini-asset","commit_stats":{"total_commits":920,"total_committers":75,"mean_commits":"12.266666666666667","dds":"0.29891304347826086","last_synced_commit":"017350eb1a546608d0aaaacf1853af2be95248fc"},"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fmini-asset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fmini-asset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fmini-asset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fmini-asset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markstory","download_url":"https://codeload.github.com/markstory/mini-asset/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471059,"owners_count":22076585,"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":["asset-builder","asset-pipeline","php"],"created_at":"2024-10-13T10:31:53.700Z","updated_at":"2025-05-16T05:07:48.599Z","avatar_url":"https://github.com/markstory.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mini Asset\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.txt)\n[![Build Status](https://travis-ci.org/markstory/mini-asset.svg?branch=master)](https://travis-ci.org/markstory/mini-asset)\n[![codecov.io](https://codecov.io/github/markstory/mini-asset/coverage.svg?branch=master)](https://codecov.io/github/markstory/mini-asset?branch=master)\n[![Total Downloads](https://img.shields.io/packagist/dt/markstory/mini-asset.svg?style=flat-square)](https://packagist.org/packages/markstory/mini-asset)\n\nMini Asset is a small footprint library that provide tools to assist in\nbuilding an asset minification/optimization pipeline. It uses a simple INI\nbased configuration file that lets you define output files, that are comprised\nof a number of input files. Input files can be processed by filters on\na per-extension or per file basis.  Filters allow you to integrate existing\npre-processors and minifiers or build your own.\n\n## Features\n\n* Built-in support for LESScss, Sass and CoffeeScript, as well as several\n  minifiers.\n* Powerful and flexible filter system allowing you to add your own\n  minifiers/pre-processors.\n* Simple ini configuration files.\n* Incremental builds that don't recompile assets when they don't need to be.\n* Command Line Tools for building and clearing assets.\n\n## Installing\n\nAdd this library to your application with composer, after that you can\nstart integrating MiniAsset into your application and use the provided CLI tools\nto generate asset targets:\n\n```\nphp composer.phar require 'markstory/mini-asset'\n```\n\n## Usage\n\nBefore MiniAsset can do anything, you'll need to define a configuration file to\ndefine your asset and which filters apply to them. For example purposes, we'll assume\nyou have some CSS files that need to be minified.\n\n### Defining a configuration file\n\nIn your application's configuration directory create a file called\n`assets.ini`. In this file we'll put all the configuration that MiniAsset\nneeds. We'll cover how to use multiple configuration files later on. Assuming your,\napplication has a `app.css` and `reset.css` put the following in your config file:\n\n```ini\n[css]\ncachePath = WEBROOT/cache_css/\npaths[] = WEBROOT/css/*\nfilters[] = SimpleCssMin\n\n[app.css]\nfiles[] = reset.css\nfiles[] = app.css\n```\n\nThe above also assumes that `WEBROOT` resolves to your application's document\nroot. In the above we defined a few sections. First, the `[css]` section defines how all\nCSS files should behave:\n\n* The `cachePath` option tells MiniAsset where to store generated assets.\n* The `paths[]` options tell MiniAsset where to find CSS files. Paths use glob syntax.\n* The `filters[]` options let you configure which filters are applied to all CSS files.\n  Filters are applied in the order they are defined.\n\nWe also defined an `[app.css]` section. This section defines the files that are used to\ncreate `WEBROOT/cache_css/app.css` when it is generated. We've added two files.\n\nSee the [sample configuration file](https://github.com/markstory/mini-asset/tree/master/config/assets.sample.ini)\nfor an annotated sample configuration file.\n\n### Use the CLI tool to build your asset\n\nWith a build target defined, we can now generate our asset. We can use the CLI\ntool to generate our assets:\n\n```sh\nvendor/bin/mini_asset build --config /path/to/assets.ini\n```\n\nThe above should generate output indicating that the `all.css` file we defined\nwas compiled. If we were to re-run the above command `all.css` would be skipped.\nMiniAsset is smart enough to know when the components of a build target change and\nonly re-build files when it is necessary.\n\nYou can also use the `mini_asset` CLI tool to clear targets:\n\n```sh\nvendor/bin/mini_asset clear --config /path/to/assets.ini\n```\n\n### PSR7 Middleware\n\nMini-asset provides a PSR7 middleware adapter that implements the pattern found in\nzendframework/zend-stratagility and SlimPHP. Before you can use the middleware provided by\nmini-asset be sure to setup a config file with your assets. Next, integrate mini-asset into your\nmiddleware stack. For example in a SlimPHP app you would do:\n\n```php\nuse MiniAsset\\AssetConfig;\nuse MiniAsset\\Middleware\\AssetMiddleware;\n\n$assetConfig = AssetConfig::buildFromIniFile(__DIR__ . '../config/assets.ini');\n$assets = new AssetMiddleware($assetConfig);\n\n$app-\u003eadd($assets);\n```\n\n## Framework Integrations\n\n* CakePHP - [AssetCompress plugin](https://github.com/markstory/asset_compress).\n\n## Issues\n\nPlease report any issues you have with the plugin to the [issue\ntracker](http://github.com/markstory/mini-asset/issues) on github.\n\n## License\n\nMini Asset is offered under an [MIT license](http://www.opensource.org/licenses/mit-license.php).\n\n## Copyright\n\n2010-2018 Mark Story (http://mark-story.com)\n\n### Authors\n\nSee the [github contributors list](https://github.com/markstory/mini-asset/graphs/contributors).\n\n### Changelog\n\nSee CHANGELOG for changes only available on `master`. See\n[github releases](https://github.com/markstory/mini-asset/releases) for changelogs on previous releases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkstory%2Fmini-asset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkstory%2Fmini-asset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkstory%2Fmini-asset/lists"}