Sublime Forum

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

#1

Regarding a package like this one:

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.

0 Likes

#2

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.

0 Likes

#3

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.

0 Likes

#4

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 :frowning:

0 Likes