-
Notifications
You must be signed in to change notification settings - Fork 178
cc Ajaxmin Obfuscator #380
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
base: cc
Are you sure you want to change the base?
Conversation
Modified ss.Bind to ease AjaxMin obfuscation Removed KeepDuplicates from WebTarget because of UnexpectedAttribute Error
Its generally better to discuss such large changes before an actual pull request. Lots of questions come to mind. Some important ones that are independent of actual code:
|
Dear Nikhil, Thanks for your time and thanks for providing us with ScriptSharp.
Best regards |
Yes, I do get the distinction between minimization and actual obfuscation, and this would certainly help those who need to obfuscate in addition. It sounds like to be effective, you want to obfuscate a set of libraries at a time, rather than minimization which works at the level of a single file. That is fine. However, that suggests obfuscation is a separate tool, and doesn't need to be in the core script# pipeline, because the script# compiler works at the level of a single assembly/script. What we should do is produce the symbol file from the script#, but make it json rather than xml (.jsi? - .js info). XML just seems antiquated. The symbol file contains literally whatever symbol info we got from c#. It doesn't contain any renaming done for obfuscation... as that is the job of the obfuscator. The deployment msbuild task isn't necessarily the right place to do obfuscation either, since a web app may or may not have all scripts deployed via that mechanism. So again, obfuscation would be a separate tool. This separate obfuscator tool works against the produced .js and .jsi files to do whatever it needs. Any options etc. for obfuscation do not need to affect the script# compiler. What we should do in script# is go ahead and define explicit semantics for preserving name - we should update the existing ScriptName attribute to add those new capabilities. For example, specifying an explicit script name both supplies generated name as well as suppresses obfuscation... what we need to add is ability to suppress obfuscation without specifying an explicit name. Makes sense? |
Dear Nikhil,
I've added an AjaxMin obfuscation engine to ScriptSharp.
It uses metadata (symbols) gathered during ScriptSharp compilation to create AjaxMin rename/norename file.
Obfuscation process has 3 modes: None, X, Full defined in the .csproj (see ScriptSharpWeb.targets)
X : will prefix obfuscated names with a X. It greatly helps debugging JavaScript while validating obfuscation.
Full : will make your JavaScript human unreadable.
You can prevent obfuscation on class/properties/methods with the ScriptImport and ScriptAlias attributes. This is helpful if you use Enum names in your code and don’t want them to be renamed in obfuscated JavaScript.
Changes to ScriptSharp generator are insignificant. I hope this pull request will make its way into the main repository.
Regards