capitalize-loader

1.0.1 • Public • Published

npm node cover size

capitalize-loader

A capitalize loader for webpack. Just capitalize the source content.

i like skating. >>> I Like Skating.

Getting Started

To begin, you'll need to install capitalize-loader:

npm install capitalize-loader --save-dev

Then add the loader to your webpack config. For example:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.txt$/,
        use: "capitalize-loader",
      },
    ],
  },
};

You can also provide some options for the loader. For example:

{
    test: /\.txt$/,
    use: {
        loader: 'capitalize-loader',
        options: {
            regExp: /(^|\s+|\W)[a-z]{1}/g,
            outputPath: './dist',
            fileName: '[name]-[contenthash:5].[ext]',
            processor: (source, options) => {
                return source.replace(/raw/, 'short')
            }
        }
    }
}

And run webpack via your preferred method.

Options

Name Type Default Description
esModule {Boolean} true use ES module syntax, default as cjs
regExp {RegExp} /(^| \s+)[a-z]{1}/g regExp for content parse
processor {Function} null custom processor | (source, options)
outputPath {String} ./ output path
fileName {String} null output filename

License

MIT

/capitalize-loader/

    Package Sidebar

    Install

    npm i capitalize-loader

    Weekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    5.71 kB

    Total Files

    4

    Last publish

    Collaborators

    • babychin