🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ref-loader

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ref-loader

A webpack loader that will create dependencies between any files manually

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
271
30.29%
Maintainers
1
Weekly downloads
 
Created
Source

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'

Keywords

ref

FAQs

Package last updated on 19 Nov 2018

Did you know?

Socket

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