{"id":15059695,"url":"https://github.com/andys8/elm-asset-webpack-loader","last_synced_at":"2026-03-16T19:31:29.851Z","repository":{"id":49113639,"uuid":"198056033","full_name":"andys8/elm-asset-webpack-loader","owner":"andys8","description":"Webpack loader for assets (like images or fonts) in Elm programming language","archived":false,"fork":false,"pushed_at":"2021-06-28T14:06:34.000Z","size":109,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T06:54:38.177Z","etag":null,"topics":["elm","elm-lang","image","loader","webpack"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/elm-asset-webpack-loader","language":"JavaScript","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/andys8.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-07-21T12:53:53.000Z","updated_at":"2024-10-31T13:06:20.000Z","dependencies_parsed_at":"2022-08-29T02:12:19.954Z","dependency_job_id":null,"html_url":"https://github.com/andys8/elm-asset-webpack-loader","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/andys8%2Felm-asset-webpack-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andys8%2Felm-asset-webpack-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andys8%2Felm-asset-webpack-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andys8%2Felm-asset-webpack-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andys8","download_url":"https://codeload.github.com/andys8/elm-asset-webpack-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166223,"owners_count":21058475,"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":["elm","elm-lang","image","loader","webpack"],"created_at":"2024-09-24T22:46:43.738Z","updated_at":"2026-03-16T19:31:29.805Z","avatar_url":"https://github.com/andys8.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `elm-asset-webpack-loader`\n\nWebpack loader for assets (like images or fonts) in Elm programming language\n\n## Usage\n\n```elm\nimg [ src \"require:src/assets/logo.svg\" ] []\n```\n\n## Webpack\n\n- This loader is meant to be run in combination with [`elm-webpack-loader`](https://github.com/elm-community/elm-webpack-loader)\n- The configuration isn't allowed to have `noParse` for elm files\n\n```js\n{\n  test: /\\.elm$/,\n  use: [\n    {\n      loader: require.resolve(\"elm-asset-webpack-loader\")\n    },\n    {\n      loader: require.resolve(\"elm-webpack-loader\")\n    }\n  ]\n}\n```\n\nWith this configuration other loaders (like this `svg` example) can be used:\n\n```javascript\n{\n  test: /\\.svg$/,\n  loader: require.resolve(\"file-loader\"),\n  options: {\n    name: \"static/media/[name].[hash:8].[ext]\"\n  }\n}\n```\n\n## Goals\n\n### Path safety\n\nThe build should fail at compile time if an asset path is used, that isn't existing or misspelled.\n\n### Webpack loaders\n\nWith this approach any webpack loader can be used. Use cases can be to hash file names, to optimize images and more. See [awesome-webpack#loaders](https://github.com/webpack-contrib/awesome-webpack#loaders).\n\n## Prior art and alternatives\n\n- [`elm-assets-loader`](https://github.com/NoRedInk/elm-assets-loader) is a comparable approach, and is more sophisticated. The package is marked as deprecated.\n- [`babel-elm-assets-plugin`](https://github.com/cultureamp/babel-elm-assets-plugin) is using babel. It mentions to disable Elm optimization. This could be because it's using a `String` `type alias`.\n- It's possible to require files in JavaScript and pass them as flags to Elm ([Instructions](https://github.com/halfzebra/create-elm-app/tree/748391d68e5ddaa5e1ae1dca866c68a5e42ff53d/template/README.md#adding-images-and-fonts))\n\n## Release\n\n- Bump version in `package.json`\n- [Create a release on github](https://github.com/andys8/elm-asset-webpack-loader/releases/new)\n- [CI will release to NPM](https://github.com/andys8/elm-asset-webpack-loader/blob/master/.github/workflows/publish.yaml)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandys8%2Felm-asset-webpack-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandys8%2Felm-asset-webpack-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandys8%2Felm-asset-webpack-loader/lists"}