Rerouted (retagged, verified). The tag now points at a different commit than when this version was published. The Lamdera package server serves a copy recovered from https://github.com/proda-ai/elm-svg-loader.
What we checked: Tag 1.0.0 now points at 684c6587d114, not the published commit. Rebuilt with git archive from commit e140b5da7e3c of https://github.com/proda-ai/elm-svg-loader (zip prefix proda-ai-elm-svg-loader-e140b5d/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 8fb1082d11a88934fb5942d39b6e32fa6b4ff924.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/proda-ai/elm-svg-loader/zipball/1.0.0/
NOTE: elm 0.19 package of rnons/elm-svg-loader
A webpack loader that inlines external SVG file into Elm views. It consists of a elm package and a npm package. DEMO.
Inspired by elm-css-modules-loader.
module Main exposing (..)
import Svg.Attributes
import InlineSvg exposing (inline)
{ icon } =
inline
{ github = "./svg/github.svg"
, share = "./svg/share.svg"
}
view =
div
[]
[ icon .github [ Svg.Attributes.class "icon icon--github" ]
, icon .share [ Svg.Attributes.class "icon icon--share" ]
]Add elm-svg-loader and raw-loader to your project.
npm install raw-loader elm-svg-loader --save-devor
yarn add raw-loader elm-svg-loader --devmodule.exports = {
⋮
module: {
rules: [
{
test: /\.elm$/,
use: [
{
loader: "elm-svg-loader",
},
{
loader: "elm-webpack",
}
],
},
{
test: /\.svg$/,
loaders: ["raw-loader"]
}
⋮
],
},
};elm-package install rnons/elm-svg-loaderThen you can import InlineSvg as in the Overview section.
Without elm-svg-loader, webpack will compile
{ icon } =
inline
{ github = "./svg/github.svg"
, share = "./svg/share.svg"
}to
var _user$project$Main$_p0 = _rnons$elm_svg_loader$InlineSvg$inline(
{github: './svg/mark-github.svg', share: './svg/share.svg'});elm-svg-loader will replace the svg file location with a require statement
var _user$project$Main$_p0 = _rnons$elm_svg_loader$InlineSvg$inline(
{github: require('./svg/mark-github.svg').default.content