ref-loader

1.0.3 • Public • Published

A webpack loader that will create dependencies between any files manually

Usage

Use @ref(./anyfile.ext) in any text file will build a dependency from current file to anyfile.ext; Then it will replace @ref() markup to module result of anyfile.ext.

Example

// Webpack config
const rules = [
  {
    test: /\.png$/,
    use: [{ loader: 'file-loader'}]
  },
  {
    test: /\.html$/,
    use: [
      { loader: 'file-loader' },
      { loader: 'extract-loader' },
      { loader: 'ref-loader' },
    ]
  }
];
<!-- avatar_page.html -->
<html>
  <img src="@ref(./avatar.png)" /> 
  <!-- Will change to -->
  <!-- <img src="a8ea0cfae3d6cfd2f079a9d70ee61a63.png" /> -->
</html>
// index.js
import './avatar_page.html'

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    567
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    567
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i ref-loader

Weekly Downloads

567

Version

1.0.3

License

MIT

Unpacked Size

3.81 kB

Total Files

5

Last publish

Collaborators

  • leecjson