babel-plugin-caralho

Babel plugin for writing curse words instead of important because reasons

WTFPL License

Stars
9
Committers
3

babel-plugin-caralho

Babel plugin for writing curse words instead of important because reasons

Example

The example is in styled-components but it also works with Glamor as seen here and Emotion as seen here because it just looks for strings.

In

import React from 'react';
import styled from 'styled-components';

const Title = styled.h1`
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
`;

const Wrapper = styled.section`
  padding: 4em;
  background: papayawhip !fuck;
`;

render(
  <Wrapper>
    <Title>Hello World, this is my styled component!</Title>
  </Wrapper>
);

Out

import React from 'react';
import styled from 'styled-components';

const Title = styled.h1`
  font-size: 1.5em;
  text-align: center;
  color: palevioletred;
`;

const Wrapper = styled.section`
  padding: 4em;
  background: papayawhip !important;
`;

render(
  <Wrapper>
    <Title>Hello World, this is my styled component!</Title>
  </Wrapper>
);

Installation

$ npm install babel-plugin-caralho --save-dev
or
$ yarn add babel-plugin-caralho --dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["caralho"]
}

Via CLI

$ babel --plugins caralho script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["caralho"]
});

Words

Instead of !fuck, you can also choose from many more options in different languages and all of them will become !important after Babel does his/her thing.

I want to add words !

Awesome ! You can create a PR here: https://github.com/SaraVieira/curse-words and these tests and the ones in https://github.com/SaraVieira/postcss-caralho will be generated automatically 🎉

License

WTFPL – Do What the Fuck You Want to Public License.