Obfuscate CSS and JavaScript for free

4

Good afternoon, I'm developing a page and I want to obfuscate CSS and Javascript (AngularJS), I did a quick search on the internet and I saw some paid tools, and some Free tools made the obfuscation very basic being possible to manually go back the original properties for reading and also very limited as letting overshadowing 10 files at a time etc.

Is there any simple, free and effective way?

    
asked by anonymous 22.09.2016 / 16:57

1 answer

5

For JS the two tools I've used directly are: UglifyJS and Google Closure Compiler .

Both go beyond a simple substitution in variable names. They analyze the code and can produce an even smaller version of your code by detecting functions or dead blocks (unreachable.)

Nowadays, in most cases for me, I no longer use these tools directly. They end up being invoked as part of a pipeline. Type, I write my code in ES6, hence something like this: *.js (ES6)WebpackBabel*.js (ES5)Uglifycombinação (bundling)browser .

As for CSS, it's hard to overshadow because the class names need to be the same as those used in your HTML and JS. Even so, you can compress a bit. In the past I used the YUI Compressor but now I leave it all because of a pipeline. I write my stylesheets in LESS and it follows: *.lessWebpacklessc*.cssminificaçãocombinação (bundling)browser .

Some of the above items are more difficult to use with Angular 1, especially Webpack. But you can either delete them or look for alternatives.

    
22.09.2016 / 17:38