0.0.6 • Published 2 years ago
babel-plugin-ot-ignore v0.0.6
babel-plugin-ot-ignore
A Babel plugin that adds configurable data-ot-ignore='' and className='optanon-category-C0001'
to all React elements (script, img, iframe, embed...) which have src attribute.
Installation
npm i babel-plugin-ot-ignoreOr
yarn add babel-plugin-ot-ignoreUsage
Add to your .babelrc file:
{
"plugins": ["babel-plugin-ot-ignore"]
}If you want to pass custom configuration options use .babelrc.js
module.exports = function (api) {
...
const plugins = [
...
[
'babel-plugin-ot-ignore',
{
otDataAttribute: "data-ot-ignore",
otClassName: "optanon-category-C0001",
srcValueRegex: /^https:\/\/yoursite.com/,
},
],
...
];
return {
...
plugins,
...
};
};Example
This jsx code:
const MyComponent = () => (
<div>
<img src="http://placekitten.com/200/300" />
</div>
);Will be transformed to:
const MyComponent = () => (
<div>
<img src="http://placekitten.com/200/300" data-ot-ignore="" className="optanon-category-C0001" />
</div>
);0.0.4-beta
2 years ago
0.0.5
2 years ago
0.0.3-beta
2 years ago
0.0.6
2 years ago
0.0.2-beta
2 years ago
0.0.1-beta
2 years ago