Lessons: 34Length: 2.5 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

4.4 Fetch Files With Ease

The next tool that I will demonstrate was also one commissioned by me and Nettuts and that's called Fetch. So my idea behind this, which I commissioned somebody to create for the community was a tool that will allow you to pull in zip files or single files and instantly have them in your project. So think about how many times have you needed to use maybe jQuery and maybe you didn't already have it local. And you couldn't remember what the CDN URL was. So you ended up just going on the web and searching for it or you went to code.jquery.com and that all just takes up time. Wouldn't it be cooler if you could say from within Sublime, hey, Sublime, pull in the latest version of jQuery for me and that's what Fetch does for us. So let's close this out. And within my Sites directory, we'll create a new one called sample. And now I'm going to drag that in to Sublime. But it would also be nice if I could right-click and choose open in Sublime. And I'll show you how to do that in a future lesson. But for now, let's just drag that empty folder in. Now we're going to install the Nettuts Plus Fetch Plugin. Shift+Cmd+P, install. I'm gonna look for nettuts+Fetch. There we go. So this will again, allow us to Fetch single files and zip files. So you could pull an HTML5 boiler plate in four seconds. Let's search for it. We could either go to Sublime > Preferences > Browse Packages and look at the documentation. Or I'm going to bring up Fetch and there we go. We want Manage > Remote Files. So it's separated into two JavaScript objects, files and packages. And he's provided a couple samples for you. So the first one is jQuery. That is the source to the minified version of jQuery as you can see right there. So now we've set up an identifier. So if I close this out, I will create a new file and we're gonna save it as jquery.js. Now rather than opening a web browser, Shift+Cmd+P. We're gonna fetch a single file and we're going to bring in jQuery. And now you have the latest version of jQuery. So you would do this for all of the projects that you work on. For example, I use normalize.css in lots of my projects. So I would go to the GitHub project. Download the latest version. Or why don't we instead do this, let's find it on GitHub. Here we go. Source code on GitHub and then we'll grab that file. View the raw contents and now that should be the master version. And that way if two months from now I fetch this file it will be the most up to date version. So I will copy that link and now once again, Fetch: Manage remove files. I'm gonna bring in a new one for normalize and paste it in like so. All right. And that's all we have to do. So let's create a new file, we'll save it as normalize.css and I'm gonna fetch single file normalize and now we have the absolute latest version of that library. Now in addition to fetching single files, we can also fetch zipped files. So notice here that we can also grab html5_boilerplate. And all you have to do is for the project you want, go to it's GitHub project or reference any zip file link. In this case, he's referencing the zipball/master and that would be if you copied the zip link from the GitHub page. So now I close this out. We're going to fetch a package html5_boilerplate. So now it's going to say, where do you want to extract these files? So why don't we within the sample directory, we'll call it boilerplate. Now it creates a new directory and you have the latest version of the boilerplate and you can go ahead and get started. So cool. Now let's do one last one together. Maybe you are a WordPress user and you want an easier way to start working with WordPress. Well, let's go to WORDPRESS.ORG and I'm gonna click on Download WordPress and this is a zip file so I'm gonna right-click and copy the link address. Now I'm gonna go back to Sublime settings. We're going to add a new one, WordPress and paste that in and we're all done. Close that out, Shift+Cmd+P, fetch a package and I want WordPress and we're gonna download this to blog. Close this out, and now in two seconds, you have the latest version of WordPress. You gotta admit, that is super, super cool.

Back to the top