Socket
Socket
Sign inDemoInstall

elm-asset-webpack-loader

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    elm-asset-webpack-loader

Webpack loader for assets (like images or fonts) in Elm programming language


Version published
Weekly downloads
1.1K
increased by23.77%
Maintainers
1
Install size
6.82 kB
Created
Weekly downloads
 

Readme

Source

elm-asset-webpack-loader

Webpack loader for assets (like images or fonts) in Elm programming language

Usage

img [ src "require:src/assets/logo.svg" ] []

Webpack

  • This loader is meant to be run in combination with elm-webpack-loader
  • The configuration isn't allowed to have 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]"
  }
}

Goals

Path safety

The build should fail at compile time if an asset path is used, that isn't existing or misspelled.

Webpack loaders

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.

Prior art and alternatives

  • 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.
  • It's possible to require files in JavaScript and pass them as flags to Elm (Instructions)

Keywords

FAQs

Last updated on 01 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc