{"id":16361780,"url":"https://github.com/kabirbaidhya/webpack-file-preprocessor-plugin","last_synced_at":"2025-07-18T19:35:34.927Z","repository":{"id":16563472,"uuid":"80201123","full_name":"kabirbaidhya/webpack-file-preprocessor-plugin","owner":"kabirbaidhya","description":"A lightweight yet generic webpack plugin for pre-processing assets before emitting.","archived":false,"fork":false,"pushed_at":"2023-01-07T11:09:16.000Z","size":1336,"stargazers_count":4,"open_issues_count":36,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-05T04:07:40.102Z","etag":null,"topics":["assets","file","plugin","preprocessor","webpack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kabirbaidhya.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-27T11:08:57.000Z","updated_at":"2023-07-12T20:47:52.000Z","dependencies_parsed_at":"2023-01-11T20:25:00.941Z","dependency_job_id":null,"html_url":"https://github.com/kabirbaidhya/webpack-file-preprocessor-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kabirbaidhya/webpack-file-preprocessor-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fwebpack-file-preprocessor-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fwebpack-file-preprocessor-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fwebpack-file-preprocessor-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fwebpack-file-preprocessor-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kabirbaidhya","download_url":"https://codeload.github.com/kabirbaidhya/webpack-file-preprocessor-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabirbaidhya%2Fwebpack-file-preprocessor-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265820261,"owners_count":23833563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assets","file","plugin","preprocessor","webpack"],"created_at":"2024-10-11T02:14:48.967Z","updated_at":"2025-07-18T19:35:34.908Z","avatar_url":"https://github.com/kabirbaidhya.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack File Preprocessor Plugin\n\n[![NPM Version](https://img.shields.io/npm/v/webpack-file-preprocessor-plugin.svg?style=flat-square\u0026color=blue)](https://www.npmjs.com/package/webpack-file-preprocessor-plugin)\n[![NPM Downloads](https://img.shields.io/npm/dt/webpack-file-preprocessor-plugin.svg?style=flat-square\u0026color=brightgreen)](https://www.npmjs.com/package/webpack-file-preprocessor-plugin)\n[![Travis Build](https://img.shields.io/travis/com/kabirbaidhya/webpack-file-preprocessor-plugin/master?style=flat-square\u0026color=brightgreen)](https://travis-ci.com/kabirbaidhya/webpack-file-preprocessor-plugin)\n[![Code Coverage](https://img.shields.io/codecov/c/github/kabirbaidhya/webpack-file-preprocessor-plugin/master?style=flat-square\u0026color=brightgreen)](https://codecov.io/gh/kabirbaidhya/webpack-file-preprocessor-plugin)\n[![NPM license](https://img.shields.io/npm/l/webpack-file-preprocessor-plugin?style=flat-square\u0026color=brightgreen)](https://github.com/kabirbaidhya/webpack-file-preprocessor-plugin/blob/master/LICENSE)\n[![PRs](https://img.shields.io/badge/PRs-Welcome-brightgreen?style=flat-square)](https://github.com/kabirbaidhya/webpack-file-preprocessor-plugin/pulls)\n\nA lightweight yet generic webpack plugin for pre-processing assets before emitting.\n\n## Installation\n\n```bash\n# Using npm\n$ npm install webpack-file-preprocessor-plugin --save-dev\n\n# Using Yarn\n$ yarn add webpack-file-preprocessor-plugin --dev\n```\n\n## Usage\n\nThis example demonstrates how to use this plugin to minify the html assets loaded using `file-loader`.\n\n```javascript\nconst WebpackFilePreprocessorPlugin = require('webpack-file-preprocessor-plugin');\nconst minifyHtml = require('html-minifier').minify;\n\nmodule.exports = {\n  entry: {\n    app: './index.js'\n  },\n  output: {\n    path: './public/dist',\n    publicPath: '/dist/',\n    filename: '[name].bundle.js'\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.html$/,\n        use: {\n          loader: 'file-loader',\n          options: {\n            name: 'tmpl/[hash].html'\n          }\n        }\n      }\n    ]\n  },\n  plugins: [\n    new WebpackFilePreprocessorPlugin({\n      // Prints processed assets if set to true (default: false)\n      debug: true,\n      // RegExp pattern to filter assets for pre-processing.\n      pattern: /\\.html$/,\n      // Do your processing in this process function.\n      process: source =\u003e minifyHtml(source.toString())\n    })\n  ]\n};\n```\n\n## Examples\n\n1. [HTML Minifier](examples/html-minifier) - A simple example of minifying raw HTML files before they're emitted using this plugin.\n2. [JS Minifier](examples/js-minifier) - A simple example of minifying javascript files before they're emitted using this plugin.\n3. [CSS Minifier](examples/css-minifier) - A simple example of minifying css files before they're emitted using this plugin.\n\n## Changelog\n\nCheck the [CHANGELOG](CHANGELOG.md) for release history.\n\n## License\n\nLicensed under [MIT](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabirbaidhya%2Fwebpack-file-preprocessor-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabirbaidhya%2Fwebpack-file-preprocessor-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabirbaidhya%2Fwebpack-file-preprocessor-plugin/lists"}