Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/felix-kaestner/babel-plugin-transform-strip-block
Strip blocks of code marked by special comment tags.
https://github.com/felix-kaestner/babel-plugin-transform-strip-block
Last synced: about 5 hours ago
JSON representation
Strip blocks of code marked by special comment tags.
- Host: GitHub
- URL: https://github.com/felix-kaestner/babel-plugin-transform-strip-block
- Owner: felix-kaestner
- License: mit
- Created: 2020-09-27T11:22:59.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-11T09:29:06.000Z (over 2 years ago)
- Last Synced: 2024-11-10T23:56:58.559Z (5 days ago)
- Language: JavaScript
- Size: 351 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-transform-strip-block
> Strip blocks of code marked by special comment tags.
Using npm:
```sh
npm install --save-dev babel-plugin-transform-strip-block
```or using yarn:
```sh
yarn add babel-plugin-transform-strip-block --dev
```## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": [
[ "babel-plugin-transform-strip-block", { "requireDirective": true, "identifiers": [{ "start": "block:start", "end": "block:end" }] }]
]
}
```### Via Webpack
**.webpack.config.js**
```javascript
...
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
['babel-plugin-transform-strip-block', { requireDirective: true, identifiers: [{ start: 'block:start', end: 'block:end' }] }]
]
}
}
}
]
...
```### Example
In:
```javascript
// @strip-blockconst foo = {
/* block:start */
bar: 'baz',
/* block:end */
}
```Out:
```javascript
const foo = {}
```