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

`debug` option is ignored #58

Closed
ThiefMaster opened this Issue Jul 22, 2015 · 13 comments

Comments

Projects
None yet
3 participants
@ThiefMaster

ThiefMaster commented Jul 22, 2015

Right now the src version ALWAYS logs debug information, even if debug is set to false (apparently this option is completely ignored in favor of the {debug} comments).

I think it would be much cleaner to also add a check for the debug option the debug code really only runs if debugging is enabled.

@running-coder

This comment has been minimized.

Owner

running-coder commented Jul 22, 2015

Yea, I was expecting people to use the src version to setup their Typeaheads and once its done to switch to the build version as explained in the first lines of the documentation... perhaps I was too ambitious over that...

@ThiefMaster

This comment has been minimized.

ThiefMaster commented Jul 22, 2015

In our application we use the src version since we have a custom build step for production which minifies all the js/css files (instead of using the minified upstream versions).

@running-coder

This comment has been minimized.

Owner

running-coder commented Jul 22, 2015

there is a unminified version that strips all the debug info and dramatically reduce the file size (you can see what it does inside Gruntfile.js) but i guess you are right I should re-enable the debug parameter and not force it

p.s. you should try to find a way to use the build version, its much lighter but I guess that if you minify and gzip there is not much impact at the end

@ThiefMaster

This comment has been minimized.

ThiefMaster commented Jul 22, 2015

From what I've see the only difference is the lack of comments in the build version. These are already stripped when we minify everything so I guess the end result is pretty much the same.

@running-coder

This comment has been minimized.

Owner

running-coder commented Jul 22, 2015

i doubt your application minification is doing this

           removeDebug: {
                options: {
                    patterns: [
                        {
                            match: /\/\/\s?\{debug}[\s\S]*?\{\/debug}/g,
                            replacement: ''
                        }
                    ]
                },

but then I could be wrong..

@ThiefMaster

This comment has been minimized.

ThiefMaster commented Jul 22, 2015

You're right, we aren't doing that ;)

@running-coder

This comment has been minimized.

Owner

running-coder commented Jul 22, 2015

at this point as mentionned it is very trivial if your application prod environment is serving gzipped files from a cdn

I'll fix the debug option as it may prevent some unwanted console message and lead to missunderstanding

thanks for your input

@running-coder

This comment has been minimized.

Owner

running-coder commented Jul 25, 2015

There we go 👍 , I've also removed the unminified version inside /dist/ to avoid confusion

running-coder added a commit that referenced this issue Sep 13, 2015

Version 2.1.0
New Features
Closes #30 #71 Adding correlativeTemplate to compile the template and soften the search matching mechanism
Closes #67 Adding the possibility to have the {{query}} word replace inside the Ajax Url
Closes #65 Added Bootstrap example

Fixes #54: onSubmit callback was not receiving proper item information
Fixes #58: Debug option is now being considered and will not print if set to false, make sure to use the /dist/jquery.typeahead.min.js version in production
Fixes #62 IE9 doesn't trigger "input" event when text gets removed
Fixes #64 options.template was unable to display "false" or "0" value
@ThiefMaster

This comment has been minimized.

ThiefMaster commented Dec 7, 2015

What about debug: undefined as a default which shows the warning message about using a debug version in production, and not showing it when explicitly setting a value for debug? That way the typical user gets the information, but if you use the debug version on purpose (maybe you want to enable debug in certain cases but not in others) and set the debug option the warning wouldn't show up.

@running-coder

This comment has been minimized.

Owner

running-coder commented Dec 7, 2015

That could work, I was worried that people would forget and use the larger file

@stevanradakovic

This comment has been minimized.

stevanradakovic commented Jun 20, 2018

I'm sorry for bringing this up again, but in debian packaging there's both jquery.typeahead.js and the minified version. Unfortunately they both include the 'debug' section which prints debug logs to the console when typeahead js is loaded. Is there any way to explicitly turn this off without modifying the source files?

@running-coder

This comment has been minimized.

Owner

running-coder commented Jul 19, 2018

hey @stevanradakovic, jquery.typeahead.min.js is cleaned from any debug code. The js Gulp task ensures it on line 73. Also if you search the dist source file there is only 1 debug occurrence.

@stevanradakovic

This comment has been minimized.

stevanradakovic commented Jul 20, 2018

@running-coder yes I realized that this is a debian problem I'll have to ping the package maintainers in debian, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment