Home Download Buy Blog Forum Support

jQuery package go in it's own folder or under JavaScript?

jQuery package go in it's own folder or under JavaScript?

Postby jakobud on Wed Jun 13, 2012 10:44 pm

Regarding a package like this one:

https://github.com/SublimeText/jQuery

jQuery is a subset of JavaScript. Do I put this package in it's own folder like this:

/Data/Packages/jQuery

or do I put it somehow under /Data/Packages/JavaScript ? And if so, how do I organize it in that folder exactly?

Basically, I want access to both JavaScript and jQuery snippets when editing a JavaScript file. I'd like to avoid just lumping everything together in the same folder if possible (can you use subfolders and if so how exactly), in order to make it easy to update/find/edit snippets in the future.
jakobud
 
Posts: 37
Joined: Wed Feb 17, 2010 6:05 pm

Re: jQuery package go in it's own folder or under JavaScript?

Postby agibsonsw on Wed Jun 13, 2012 11:23 pm

You can pretty much put files anywhere within your ST-Packages folder and they will work okay. I would, as you suggest, create a jQuery folder.

A fork of that jQuery package is available via Package Control. It's best to install via Package Control whenever possible, as the files will be put in sensible location(s) and the package will be updated automatically.

If you prefer, I have a (single) jQuery-completions file available here - rather than a large number of individual snippets. Create your jQuery folder and copy my file to this. If you want to use jQuery within any/all JavaScript files then modify the scope in my file from source.js.jquery to just source.js. [Otherwise, you'll need a jQuery syntax (.tmLanguage) file!]

There's a bit more information about my completions on my Wiki.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm

Re: jQuery package go in it's own folder or under JavaScript?

Postby jakobud on Thu Jun 14, 2012 4:03 pm

I installed the jQuery package as you recommended. But still, when working in a .js file, I have to manually switch between jQuery and JavaScript as the syntax type. How come it can't do both at the same time? ST can do PHP and HTML in the same file at the same time, so I figured it must be possible with jQuery and JS.
jakobud
 
Posts: 37
Joined: Wed Feb 17, 2010 6:05 pm

Re: jQuery package go in it's own folder or under JavaScript?

Postby agibsonsw on Fri Jun 15, 2012 12:07 pm

jakobud wrote:I installed the jQuery package as you recommended. But still, when working in a .js file, I have to manually switch between jQuery and JavaScript as the syntax type. How come it can't do both at the same time? ST can do PHP and HTML in the same file at the same time, so I figured it must be possible with jQuery and JS.


Depending on the Package, you can amend the scope in the jQuery.tmLanguage file to 'source.js'. This scoping rule may also occur in other places, such as within a sublime-completions file; but it will probably also be in every snippet file :(
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], subhaze, Yahoo [Bot] and 11 guests