I just downloaded the pack for jquery UI, and when I extract it I get these files:
My question is that what files should I include? There're a lot of files there I'm not sure which one I'll need to put into my folders for full functionality. I know for sure I need to include jquery-ui.js or jquery-ui.min.js but I also want the themes that come with it and use them on my webpage. SHould I include the css and files inside external and images too?
It looks like you just need the minified css and js files.
http://learn.jquery.com/jquery-ui/getting-started/
Related
I am using the tinymce jquery plugin the version 3, there I have included the whole folder which I downloaded from their site, and linked the script in my jsp.
Here I need to link only one script file as you know. jquery.tinymce.js I have did that, but for using the advanced theme still I need to add some supported script files too.
I am not getting which are the only required files we need to add so I end up in adding the whole folder I guess which is not required.
Here is my project folder where I added the complete folder.
In the image we you can see the only file we are linking in jsp.
The question is what are the only required files I need to keep so that tinymce works fine with advanced theme and I want to remove the unwanted files and scripts which I am not making use of them.
Can anybody suggest me what are the files which are required.
You can fully remove the "examples" folder under tinymce.
I don't advice to delete any further, because normally the size of files is small and not worth the trouble. If you do want to continue deleting you can remove license.txt and start removing unnecessairy plugins :
Example give : if you don't want to use the Emoticons (found under plugins), delete the folder. All information on the plugins in TinyMCE 3.X can be found here http://www.tinymce.com/wiki.php/TinyMCE3x:Plugins
I have a big project and many css/less/JQuery files. and i need to include some of them in the layout and other I have to call it in action.
What is the best way to put libraries in zend layout Plus i have to minify scripts ?
shall i create a class or library for that ?
In layout (phtml) you put css/js files that u need in all views (views which used this layout). In view files you include js which will be used only in this view.
In production code u should minify your css/js files.
If your project is big you can create in main js/css folder subfolders for each controller or even action.
I add files using view helper. First i add files when needed:
$this->headScript()
->prependFile($this->baseUrl() . '/js/jquery-1.7.2.min.js');
and:
$this->inlineScript()
->appendFile($this->baseUrl() . '/js/fancybox/jquery.easing-1.3.pack.js')
Then i add <?=$this->headScript()?> in header and <?= $this->inlineScript() ?> before closing body tag.
This will not connect or/and minify your CSS/JS, and i think there is no standard ZF classes which can help you.
If you need something more than you need some work. I haven't tried myself, but friend mentioned Minify is good and easy to implement .
You can also install Google Page Speed addon for your server and it has options to minify those files (here and here).
Last option is to use YUI Compressor as shell script, but i think it's too much work.
I'm trying to optimize a Symfony 1.4 project and one thing that I would like to do is to defer JavaScript loading. I'm using the use_javascript() function to include files from inside templates.
Does use_javascript() have an options parameter (...or any documentation whatsoever?)
Alternatively, is there an alternative method for adding a tag to the collection for include_javascripts()?
Thanks for any help!
you use use_javascript('scriptname') to specify a javascript file to load - this doesn't add the JS file to the page it just allows symfony to build a list of files to include .. then to include the files you use include_javascripts() so to be "efficient" just place the include_javascripts() at the bottom of the page ...
As suggested here (jQuery example)-> http://www.symfony-project.org/jobeet/1_4/Doctrine/en/18
I am using append_to_slot('javascript') inside template. With require.js implemented
Once development is finished and I want to deploy code for end users, require.js optimizer can combine the JavaScript files together and minify it for me.
I end up with single .js file included to the page.
I am using the jquery ui, I downloaded the entire toolset.
I put the css and images into a folder like:
/images/jquery/base/
/images/jquery/ui-lightness/
How can I configure this so it works?
(if that's possible)
That is normal virtual pathing, meaning you'll have to reconfigure your .js and css files inside the plugins to look for the new path. IMO just use the default way, create an extra 'plugins' or 'extras' folder or something and avoid the trouble.
I took a snapshot of the jquery.js file and jquery-ui files that I use and dumped them into a giant .js file with all of the other .js files that I use for my site.
When I do just this with no minfication/packing, the files stop working and I get "recursion too deep" errors on the file when I try to load it on my site instead of the usual .js files. All of the errors came from jquery and jquery-ui. Using a simple numbering scheme I made sure that the jquery.js/jquery-ui files were the first listed in the file and in the correct order (the same as includes as individual files.)
Two questions:
1) Doesn't the include tags for JavaScript have the same effect as dumping all of the files into one giant file? Is there extra isolation/insulation that JavaScript files get from being in their own script tags or in different files?
2) My goal is to make my site faster by having one huge .js file with all JavaScript I ever use in my site (which is heavy in JQuery) and minify that file. Why is this misguided? What is a better way to do it?
NOTE: Google's CDN version of the JQuery files don't work for me, all of the JQuery plugins/themes I use don't work with Google's versions (anyway who says that they can successfully use Google's CDN is lying.)
UPDATE: Thanks for the good advice in the answers, all of it helped me learn more about deploying JavaScript files on a production server. I am actually always using the latest SVN branch of the JQuery UI plugins and there were errors in the UI plugins that prevented them from being merged together with my files. I got the latest Theme Rolled plugins that are already minified in one file and that worked around the problem.
Probably your JavaScript files have some syntax errors. Browser can correct them when loading files one by one, but fail when "bad" files combined. You can try to compile your file using Rhino compiler (http://www.mozilla.org/rhino/)
java -cp build/js.jar org.mozilla.javascript.tools.jsc.Main giant.js
Also you can use JSLint validator (http://www.jslint.com/), thought likelly it will not be able to handle jQuery. But you still can combine all your files and validate them.
I'd recommend using a script manager such as this one to only register the files and plugins you need, and load them on the fly.
This keeps your requests to a minimum, and you don't have to load some huge 300k JS file one very page.
Another problem could be the load order changed. Most JavaScript files should be load order independent, but if you load jquery at the end after you have your:
$(document).ready(function() {});
you'll run into problems.