-
Notifications
You must be signed in to change notification settings - Fork 20.5k
CSS: save 6 bytes on the getStyles function #2393
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
Conversation
|
Actually, i see only -7 bytes between This is why i specifically didn't used any tricks to make it smaller. If it was 35 bytes it could be a close call though, but it seems 7 bytes not worth it |
+1. I prefer to keep code more readable and less complex, even if you're able to save a few bytes. 7 bytes isn't worth it IMHO. |
|
@markelog, How did you compare the size? Me, I count how many caracteres there are in the jquery.min.js before and after my change. Do I have to do something more than just start grunt? So, the main gain is not the return, it's the double of |
|
I think that @markelog is comparing the gzipped version while you're comparing the minified-only version. |
|
@AurelioDeRosa, thanks I thought the minified version was also the gzipped version... I did that version because I saw many return with ternary in the code, etc. |
|
there is a grunt task to compare the size diff: |
Yeah, i'm usually advocating against that style if there is a better way. And yes, we usually care only about gzipped size. Now it looks much better, so if no one objects and test would run smoothly i will land this |
|
LGTM. |
|
👍 |
|
@mr21 If you run You're interested in the gz min number compared to master, in this example it's +40 bytes. |
|
@mzgol, so simple. ~/GitHub/jquery>grunt
>> Local Npm module "grunt-babel" not found. Is it installed?
Running "build:all:*" (build) task
>> File 'dist/jquery.js' created.
Running "jsonlint:pkg" (jsonlint) task
>> 1 file lint free.
Running "jshint:all" (jshint) task
>> 137 files lint free.
Running "jshint:dist" (jshint) task
>> 1 file lint free.
Running "jscs:src" (jscs) task
>> 90 files without code style errors.
Running "jscs:gruntfile" (jscs) task
>> 1 files without code style errors.
Running "jscs:test" (jscs) task
>> 1 files without code style errors.
Running "jscs:release" (jscs) task
>> 1 files without code style errors.
Running "jscs:tasks" (jscs) task
>> 7 files without code style errors.
Running "uglify:all" (uglify) task
>> 1 sourcemap created.
>> 1 file created.
Running "remove_map_comment" task
Running "dist:*" (dist) task
Warning: Task "babel:nodeSmokeTests" not found. Use --force to continue.
Aborted due to warnings. |
Hi,
I saw few bytes to save after reading #2341, but I didn't change the logic.