0

I am creating a site that uses Java Script and CSS from jQuery and jQuery Mobile. Right now I am not hosting any of the files but rather referencing URLs on the jQuery site. This has the disadvantage that I have to load resources from jQuery every time the page loads and I cannot alter the files myself. I want to switch to hosting this stuff locally and would like to go about it in an organized and scalalable fashion. Is there any better way to do this than just copying the code from the links and pasting it into my own local .css and .js files?

Ben Pearce
  • 6,884
  • 18
  • 70
  • 127
  • Why are you changing the jQuery files (jQuery UI CSS, fine, but I don't know why you'd modify the jQuery or jQuery UI files)? – David Thomas Jan 24 '13 at 19:17
  • See [Why should I use Google's CDN for jQuery?](http://stackoverflow.com/q/2180391/1331430) and [Any problems/disadvantages hosting jQuery at Google?](http://stackoverflow.com/q/442894/1331430) then you can put these 2 in the balance yourself, taking in consideration that you will lose the benefits from CDN. – Fabrício Matté Jan 24 '13 at 19:17
  • Interesting. It sounds like a good set up is using Googles CDN with local backup files. What do you think about hosting the css locally. Surely I may want to change those files. – Ben Pearce Jan 24 '13 at 19:46

1 Answers1

0

Modifying the jQuery source is not ideal as you would be required to maintain it with every new release. If there is additional functionality you would like to add, it is better to create jQuery plugins. As for managing your project with respect to CSS and JavaScript files, most IDEs will generate a series of folders following the convention of JavaScript and CSS files being placed in a scripts and styles directory, respectively, under your project root. On top of this, it is wise to catalog your changes with some form of source control, such as git. There is plenty of documentation on the web on how to use this tool, and explaining how to use any form of source control is far too broad for an answer on StackOverflow. There is a certain level of mental discipline you must maintain, however, especially if you are manually managing the structure of your web project. This will come with time and experience as to what works best for you.

CassOnMars
  • 6,153
  • 2
  • 32
  • 47