{"id":13694062,"url":"https://github.com/leaanthony/mewn","last_synced_at":"2025-07-28T05:07:55.098Z","repository":{"id":57480566,"uuid":"171052656","full_name":"leaanthony/mewn","owner":"leaanthony","description":"ARCHIVED: A zero dependency asset embedder for Go","archived":false,"fork":false,"pushed_at":"2021-04-01T20:38:44.000Z","size":66,"stargazers_count":84,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T02:53:25.518Z","etag":null,"topics":["assets","assetstore","embed","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/leaanthony.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":"2019-02-16T21:13:28.000Z","updated_at":"2023-04-11T15:42:21.000Z","dependencies_parsed_at":"2022-09-26T17:41:16.803Z","dependency_job_id":null,"html_url":"https://github.com/leaanthony/mewn","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/leaanthony/mewn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaanthony%2Fmewn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaanthony%2Fmewn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaanthony%2Fmewn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaanthony%2Fmewn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leaanthony","download_url":"https://codeload.github.com/leaanthony/mewn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leaanthony%2Fmewn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267464522,"owners_count":24091505,"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-07-28T02:00:09.689Z","response_time":68,"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":["assets","assetstore","embed","go","golang"],"created_at":"2024-08-02T17:01:23.482Z","updated_at":"2025-07-28T05:07:55.073Z","avatar_url":"https://github.com/leaanthony.png","language":"Go","funding_links":[],"categories":["开源类库","Open source library"],"sub_categories":["构建编译","Build And Compile"],"readme":"# Mewn\n\n\u003ch2\u003eThis project is now being archived due to native embed functionality now available in Go\u003c/h2\u003e\n\nA zero dependency asset embedder for Go.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/leaanthony/mewn)](https://goreportcard.com/report/github.com/leaanthony/mewn) [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/leaanthony/mewn) [![CodeFactor](https://www.codefactor.io/repository/github/leaanthony/mewn/badge)](https://www.codefactor.io/repository/github/leaanthony/mewn) ![](https://img.shields.io/bower/l/svg)\n[![Generic badge](https://img.shields.io/badge/MacOS-Supported-Green.svg?style=flat)](https://github.com/leaanthony/mewn/)\n[![Generic badge](https://img.shields.io/badge/Linux-Supported-Green.svg?style=flat)](https://github.com/leaanthony/mewn/)\n[![Generic badge](https://img.shields.io/badge/Windows-Supported-Green.svg?style=flat)](https://github.com/leaanthony/mewn/)\n\n## About\n\nMewn is perhaps the easiest way to embed assets in a Go program. Here is an example:\n\n```Go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/leaanthony/mewn\"\n)\n\nfunc main() {\n\tmyTest := mewn.String(\"./assets/hello.txt\")\n\tfmt.Println(myTest)\n}\n```\n\nIf compiled with `go build`, this example will read `hello.txt` from disk.\nIf compiled with `mewn build`, it will embed the assets into the resultant binary.\n\n## Installation\n\n`go get github.com/leaanthony/mewn/cmd/mewn`\n\n## Usage\n\nImport mewn at the top of your file `github.com/leaanthony/mewn` then use the simple API to load assets:\n\n- `String(filename) (string)` - loads the file and returns it as a string\n- `Bytes(filename) ([]byte)` - loads the file and returns it as a byte slice\n- `MustString(filename) (string)` - loads the file and returns it as a string. Any error is considered fatal\n- `MustBytes(filename) ([]byte)` - loads the file and returns it as a byte slice. Any error is considered fatal\n\n### Groups\n\nTo bundle a whole directory, simply declare a group like this:\n\n`myGroup := mewn.Group(\"./path/to/dir\")`\n\nFrom this point you can use the same methods above, but on the group:\n\n`myAsset := myGroup.String(\"file.txt\")`\n\nGroups also have the following method:\n\n  - `Entries() []string` - Returns a slice of filenames in the Group\n\n\n## Mewn cli command\n\nThe `mewn` command does 3 things:\n\n- If you run `mewn`, it will recursively look for mewn.\\* calls in your .go files. It will then generate intermeriary go files with assets embedded. It does not compile them into a final binary.\n- `mewn build` will do the above, but compile all the source, then delete the intermediary files. This makes things a bit cleaner.\n- `mewn pack` will do the same as `wails build`, but will compile with the go flags `-ldflags \"-w -s\"` to compress the final binary even more.\n\nFor the `build` and `pack` subcommands, any other cli parameters will be passed on to `go build`.\n\n## Caveats\n\nThis project was built for simple embedding of assets and as such, there are a number of things to consider when choosing whether or not to use it.\n\n- Mewn just deals with bytes. It's up to you to convert that to something you need. One exception: String. Just because it's super likely you'll need it.\n- When using the top-level methods, EG: mewn.String(), it uses a default group called \".\". Creating your own group called \".\" shouldn't do anything, but I'm not going to guarrantee it. You've been warned 😉\n- Paths to assets need to be unique (within a Group). If you try to pack 2 files with the same relative path with the same group (or default group), it isn't going to work. \n- Once this project reaches 1.0, it is _extremely_ unlikely that any new features will be added in the future. This is by choice, not necessity. I want this project to be extremely stable so if you choose to use it today, it should work exactly the same in 3 years time. If it doesn't currently do what you want, you are probably looking for a different project. However, if you have a phenomenally good idea, feel free to open an issue.\n- The project works by parsing the AST tree of your code. It works when you use the form `mydata := mewn.String('./myfile.txt')` to import your data (IE string literal, not variable). It may not (yet) work for similar code. Very happy to receive bug fixes if it doesn't.\n\nBug reports are _very_ welcome! Almost as much as PRs to fix them!\n\n## What does 'Mewn' mean?\n\nMewn (MEH-OON as fast as you can say it, not meee-oon) is the [Welsh](https://en.wikipedia.org/wiki/Welsh_language) word for \"in\".\n\n## Why go for a crazy Welsh name?\n\nWell, it stands out as a project name (practically zero name clashes) and is one of the oldest and coolest languages in Europe (which I'm lucky enough to speak). JRR Tolkien was [obsessed with Welsh](http://www.bbc.co.uk/guides/z2hthyc). So much so, he based the Middle Earth Elvish language \"Sindarin\" on it and there's strong evidence he based LOTR on Welsh mythology. It's also associated with [Red Dragons](https://en.wikipedia.org/wiki/Flag_of_Wales), weirdly loved by the Bundesliga football team [FC Schalke](https://twitter.com/s04_us) and it's on [Duolingo](https://www.duolingo.com/course/cy/en/Learn-Welsh), so why not give it a go 😉.\n\n## Inspiration\n\nHeavy inspiration was drawn from [packr](https://github.com/gobuffalo/packr) by the awesome Mark Bates. The scope of what I needed was far narrower than the packr project, thus Mewn was born. If Mewn doesn't fulfil your needs, it's likely that packr will.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaanthony%2Fmewn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleaanthony%2Fmewn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleaanthony%2Fmewn/lists"}