You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.
There's a lot of repeated code that could benefit from a refactoring, with minification in mind, without impeding readability.
Stuff like:
this.picker = $(this.options.template);
if (this.options.customClass) {
this.picker.addClass(this.options.customClass);
}
if (this.options.inline) {
this.picker.addClass('colorpicker-inline colorpicker-visible');
} else {
this.picker.addClass('colorpicker-hidden');
}
could be changed to:
var options = this.options,
$picker = this.picker = $(options.template);
if (options.customClass) {
$picker.addClass(options.customClass);
}
if (options.inline) {
$picker.addClass('colorpicker-inline colorpicker-visible');
} else {
$picker.addClass('colorpicker-hidden');
}
And minified (with formatting to compare), it would look like this:
var o = this.options,
p = this.picker = $(o.template);
if (o.customClass) {
p.addClass(o.customClass);
}
if (o.inline) {
p.addClass('colorpicker-inline colorpicker-visible');
} else {
p.addClass('colorpicker-hidden');
}
Just in that small example, 44 bytes were saved. #BytesLivesMatter
This has to do with property names which can't be minified, so this.options can't be minified.
I'd be honored to propose a pull request (when I'll have time, like next week) if that's okay.
The text was updated successfully, but these errors were encountered:
There's a lot of repeated code that could benefit from a refactoring, with minification in mind, without impeding readability.
Stuff like:
could be changed to:
And minified (with formatting to compare), it would look like this:
Just in that small example, 44 bytes were saved. #BytesLivesMatter
This has to do with property names which can't be minified, so
this.options
can't be minified.I'd be honored to propose a pull request (when I'll have time, like next week) if that's okay.
The text was updated successfully, but these errors were encountered: