trim-loader

0.5.1 • Public • Published

Trim Loader

A loader for webpack that lets you import files as a trimmed string.

This differs from raw-loader in that it trims the whitespace from the start and end of the string.

Install

npm install --save-dev trim-loader

Usage

Use the loader either via your webpack config, CLI or inline.

Via webpack config (recommended)

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.txt$/,
        use: 'trim-loader'
      }
    ]
  }
}

In your application

import txt from 'file.txt';

CLI

webpack --module-bind 'txt=raw-loader'

In your application

import txt from 'file.txt';

Inline

In your application

import txt from 'trim-loader!./file.txt';

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.5.1
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.5.1
    3

Package Sidebar

Install

npm i trim-loader

Weekly Downloads

3

Version

0.5.1

License

MIT

Last publish

Collaborators

  • leviathanbadger