{"id":24489115,"url":"https://github.com/kudashevs/remove-blocks-webpack-plugin","last_synced_at":"2025-04-13T22:11:47.380Z","repository":{"id":262482970,"uuid":"887378614","full_name":"kudashevs/remove-blocks-webpack-plugin","owner":"kudashevs","description":"A webpack plugin that removes marked blocks from any code processed by webpack.","archived":false,"fork":false,"pushed_at":"2024-12-02T15:43:47.000Z","size":318,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T09:07:42.094Z","etag":null,"topics":["remove-code","remove-unwanted","webpack-plugin"],"latest_commit_sha":null,"homepage":"","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/kudashevs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-12T16:34:11.000Z","updated_at":"2025-01-11T10:54:46.000Z","dependencies_parsed_at":"2024-11-12T17:36:47.730Z","dependency_job_id":"e09c3daf-f66c-4f25-b298-4ce2ba7ada72","html_url":"https://github.com/kudashevs/remove-blocks-webpack-plugin","commit_stats":null,"previous_names":["kudashevs/remove-blocks-webpack-plugin"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudashevs%2Fremove-blocks-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudashevs%2Fremove-blocks-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudashevs%2Fremove-blocks-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kudashevs%2Fremove-blocks-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kudashevs","download_url":"https://codeload.github.com/kudashevs/remove-blocks-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788917,"owners_count":21161727,"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":["remove-code","remove-unwanted","webpack-plugin"],"created_at":"2025-01-21T16:30:48.373Z","updated_at":"2025-04-13T22:11:47.357Z","avatar_url":"https://github.com/kudashevs.png","language":"JavaScript","readme":"Remove Blocks Webpack Plugin ![test workflow](https://github.com/kudashevs/remove-blocks-webpack-plugin/actions/workflows/run-tests.yml/badge.svg)\n==========================\n\nThe `remove-blocks-webpack-plugin` removes marked blocks from any type of code.\n\n## Install\n\n```bash\n# NPM\nnpm install --save-dev remove-blocks-webpack-plugin\n# Yarn\nyarn add --dev remove-blocks-webpack-plugin\n```\n\n\n## Options\n\n`blocks` is an array of blocks' representations. Each element of this array describes a unique pair of tags with name,\nprefix, suffix and optional replacement. These values are represented by a string or an object with the following properties:\n```\nname: 'devblock'               # a string defines a name for start/end tags (unique)\nprefix: '/*'                   # a string defines the beginning of a tag\nsuffix: '*/'                   # a string defines the end of a tag\nreplacement: 'optional'        # a string defines a substitution for a removed block\n```\n\nThe plugin supports zero config. When no options are provided, it uses default name, prefix and suffix values.\n\n\n## Usage example\n\nFor example, suppose the task is to remove some debug information and non-production code from this code sample.\n```javascript\nfunction makeFoo(bar, baz) {\n    console.log('creating Foo'); \n    \n    if (bar instanceof Bar !== true) {\n        throw new Error('makeFoo: bar param must be an instance of Bar');\n    }\n    \n    if (baz instanceof Baz !== true) {\n        throw new Error('makeFoo: baz param must be an instance of Baz');\n    }\n    \n    return new Foo(bar, baz);\n}\n```\n\nThe plugin removes blocks of code marked with two paired tags (a block). A block is represented by a string or an object\nwith the properties described in \"[Options](#options)\" above. Let's identify two different blocks and describe them in the configuration:\n```javascript\n// webpack.config.js \nconst RemoveBlocksPlugin = require('remove-blocks-webpack-plugin');\n\nmodule.exports = {\n  ...\n  plugins: [\n    new RemoveBlocksPlugin({\n      blocks: [\n        'debug',\n        {\n          name: 'development',\n          prefix: '//',\n          suffix: '',\n        },\n      ],\n    }),\n  ],\n}\n```\n\nOnce the blocks are described in the configuration, the unwanted areas of code can be marked in the code:\n```javascript\nfunction makeFoo(bar, baz) {\n    /* debug:start */ console.log('creating Foo'); /* debug:end */\n    // development:start\n    if (bar instanceof Bar !== true) {\n        throw new Error('makeFoo: bar param must be an instance of Bar');\n    }\n    // development:end\n    // development:start\n    if (baz instanceof Baz !== true) {\n        throw new Error('makeFoo: baz param must be an instance of Baz');\n    }\n    // development:end\n    // This code will remain\n    return new Foo(bar, baz);\n}\n```\n\nAfter the building process, the marked blocks will be completely removed.\n```javascript\nfunction makeFoo(bar, baz) {\n    // This code will remain\n    return new Foo(bar, baz);\n}\n```\n\n\n## License\n\nThe MIT License (MIT). Please see the [License file](LICENSE.md) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkudashevs%2Fremove-blocks-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkudashevs%2Fremove-blocks-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkudashevs%2Fremove-blocks-webpack-plugin/lists"}