{"id":29955036,"url":"https://github.com/foca/mpp","last_synced_at":"2025-09-15T09:20:38.000Z","repository":{"id":29902533,"uuid":"33448213","full_name":"foca/mpp","owner":"foca","description":"The mini pre processor parses files and resolves C-style #include and #define macros","archived":false,"fork":false,"pushed_at":"2017-02-22T21:41:50.000Z","size":60,"stargazers_count":20,"open_issues_count":5,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-04-10T10:19:59.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Crystal","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/foca.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":"2015-04-05T17:04:13.000Z","updated_at":"2019-08-18T16:42:18.000Z","dependencies_parsed_at":"2022-09-16T20:51:13.003Z","dependency_job_id":null,"html_url":"https://github.com/foca/mpp","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/foca/mpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foca","download_url":"https://codeload.github.com/foca/mpp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268578914,"owners_count":24273089,"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-03T02:00:12.545Z","response_time":2577,"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":[],"created_at":"2025-08-03T17:09:18.766Z","updated_at":"2025-08-03T17:09:30.162Z","avatar_url":"https://github.com/foca.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mpp, a mini preprocessor [![Build Status](https://travis-ci.org/foca/mpp.svg?branch=master)](https://travis-ci.org/foca/mpp)\n\nThis mini preprocessor parses files and resolves `#include` and `#define` macros\nsimilar to how [`cpp(1)`](http://linux.die.net/man/1/cpp) does.\n\n## Get it\n\n### Homebrew\n\n``` sh\n$ brew tap foca/mpp\n$ brew install mpp\n```\n\n### Manually download a binary\n\nDownload the latest stable binary from our [Releases\npage](https://github.com/foca/mpp/releases/latest).\n\n### Compile from source\n\nYou will need the [Crystal](http://crystal-lang.org) compiler, and a ruby\ninterpreter to generate the man pages.\n\n``` sh\n$ git clone https://github.com/foca/mpp \u0026\u0026 cd mpp\n$ ./configure --prefix=/usr/local\n$ make\n$ make install\n```\n\n## Example\n\nGiven the following two CSS files:\n\n``` css\n/* app.css */\n\n#include \"other.css\"\n\n#define $margin 15px\n\n.something-other {\n  margin: $margin;\n}\n```\n\n``` css\n/* other.css */\n\n.something {\n  padding: 0;\n}\n```\n\nRunning `mpp app.css` will result in this:\n\n``` css\n.something {\n  padding: 0;\n}\n\n\n\n.something-other {\n  margin: 15px;\n}\n```\n\nSee the [example](./example) directory for a more interesting example.\n\n## Load Paths\n\nBy default, `mpp` will look for file paths relative to the working directory. In\norder to specify the paths to search, you should use the `-I` command line flag:\n\n```\n$ mpp example/app.css\nCan't find file other.css in /current/directory\n\n$ mpp -Iexample example/app.css\n.something {\n  padding: 0;\n}\n...\n```\n\nEach invocation of `-I` adds a new directory to the search path:\n\n```\n$ mpp -Iexample -Ivendor example/app.css\n```\n\nFiles will be searched relative to the directories in the load path in order. So\nif your search path is `[./example, ./]`, mpp will first try to open the file\n`./example/app.css`, and then `./app.css`. If neither is a file, then it will\nexit with an error status.\n\n## Make Dependencies\n\nBy passing `-M` (or `--make`) mpp will generate output suitable for a Makefile\nto define the dependencies between files, according to the `#include` rules in\neach processed file.\n\nFor example:\n\n```\n$ mpp -Iexample -M example/app.css\nexample/app.css: example/other.css\n        @touch $@\n\n$\n```\n\nYou can add this to your Makefile in order to let make handle this on its own:\n\n``` Makefile\n.deps.mk: $(ASSETS)\n        @mpp -M $^ \u003e $@\n\n-include .deps.mk\n```\n\nWhere `$(ASSETS)` is the list of all the assets that you're compiling. For\nexample, in one of my projects I have it set to\n\n``` Makefile\nASSETS = $(shell find assets/ -type f)\n```\n\nThis ensures that whenever a new asset is added / modified, `.deps.mk` is\nrebuilt, and thus the dependencies are kept up-to-date.\n\n## License\n\nLicensed under the MIT license. See the attached [LICENSE](./LICENSE) file for\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoca%2Fmpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoca%2Fmpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoca%2Fmpp/lists"}