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';

Dependents (0)

Package Sidebar

Install

npm i trim-loader

Weekly Downloads

2

Version

0.5.1

License

MIT

Last publish

Collaborators

  • leviathanbadger