Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for using with create-react-app #7

Open
Rud156 opened this issue Mar 6, 2018 · 0 comments
Open

Example for using with create-react-app #7

Rud156 opened this issue Mar 6, 2018 · 0 comments

Comments

@Rud156
Copy link

Rud156 commented Mar 6, 2018

BUG: The class names generated start with numbers and class names starting with numbers are not accepted

This is not exactly a BUG but an addition to the docs on how to use it with create-react-app will be amazingly helpful. Although it needs ejecting it would be great.

I had to pull out:

root.walkRules(rule => {
    if (!rule.selectors) {
        return rule;
    }
    rule.selectors = rule.selectors.map(
        obfuscateClassNames.obfuscateClassNamesInSelector({
            seed: "app"
        })
    );
});

An write my own postcss -loader plugin to get the obfuscation to work. But when building I get the error Failed to minify the code from this file: ./node_modules/react-armor/dist/node/prod/lib/transformClassNames.js:17

After fixing the import like import obfuscateClassNames from "react-armor/dist/node/prod/lib/obfuscateClassNames"; I now get an error saying Failed to minify the code from this file: ./node_modules/react-traverse/dist/node/prod/lib/traverse.js:43.

Managed to get it working. But its not great about how I did it. I think integration should be easier

Also can you consider recompile and public your package as ES5 to npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant