Webpack loader for assets (like images or fonts) in Elm programming language
MIT License
elm-asset-webpack-loader
Webpack loader for assets (like images or fonts) in Elm programming language
img [ src "require:src/assets/logo.svg" ] []
elm-webpack-loader
noParse
for elm files{
test: /\.elm$/,
use: [
{
loader: require.resolve("elm-asset-webpack-loader")
},
{
loader: require.resolve("elm-webpack-loader")
}
]
}
With this configuration other loaders (like this svg
example) can be used:
{
test: /\.svg$/,
loader: require.resolve("file-loader"),
options: {
name: "static/media/[name].[hash:8].[ext]"
}
}
The build should fail at compile time if an asset path is used, that isn't existing or misspelled.
With 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.
elm-assets-loader
is a comparable approach, and is more sophisticated. The package is marked as deprecated.babel-elm-assets-plugin
is using babel. It mentions to disable Elm optimization. This could be because it's using a String
type alias
.package.json