All mootools more modules are included in my app, but I would like to remove the ones I am not using. Is there a quick way to know which modules I am using starting from the script depending on mootools more?
Which modules of mootools more I am using?
111 views Asked by feychu At
2
There are 2 answers
0
On
Did you compress the file?
If you haven't removed the original comments from your build, there should be a link at the top of your file with a list of the included packages and a link. e.g.
// Load this file's selection again by visiting: http://mootools.net/more/065f2f092ece4e3b32bb5214464cf926
If you don't have the link, but other comments are included, search the file for script:
and you should get a list back of all the included packages.
no easy way, I am afraid. you can spy on stuff while your app runs so you can get some usage/coverage stats but because mootools is prototypal, the extensions to Array/String/Function/Date etc that more does may be more complicated to catch.
To catch classes that have been instantiated, build a list and use something like that:
as soon as any of these items gets instantiated OR extended, the constructor will get referenced and you will get the log to show it. http://jsfiddle.net/dimitar/8nCe6/ - this will instantiate
Request.JSONP()
.I wrote the
Object.monitor
to spy on methods being called on a particular instance but the same principle applies. The console formatting only works nice in FireBug and WebInspector - native FF console needs to be made simple.http://fragged.org/spy-on-any-method-on-an-object-and-profile-number-of-times-called_1661.html
you can use it to spy on say,
Array.prototype
or any suchlike as well - but the difficulty is the code complexity of more. Hard to really nail it down :(probably easier to concatenate all your scripts EXCEPT for mootools-more then grep for known classes / methods from the Types.