Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
by
FREELessons:34Length:2.5 hours

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

5.6 All About Projects

Today I'd like to talk a bit about projects. So, let's say that I just downloaded a fresh installation of the WordPress framework. Let me go ahead and bring that into Sublime Text. There's one problem here. I am likely never going to edit a huge number of these files. I doubt that I will be going into WP load or WP log in. In these cases, that can be a bit of a pain. Likely all that I'm interested in is maybe the themes directory and, or the plug ins directory. So, wouldn't it be great if I could just pick and grab the folders and files that I need? Well, actually we can. I'm gonna go to Project, Save Project As. We'll save this in the same folder, and we'll call it Mytheme.sublime-project. So, now you'll see it added these two new files, the project and the workspace. So, the project contains the basic meta information. But here's what's cool. Take a look at this path. That's pointing to the path to our WordPress folder. If I were to change that and hit Save, the sidebar will immediately update to show what's in the desktop. But here's the coolest part if I backtrack just a ways and save it. Now, let's set this to WP content, and let's open that up. And we're gonna go into the theme's directory, and let's say the theme we're working on is the 2011 theme. Now if I save that, all we are displaying is that one folder. But we can set more. This is an array, here. So, why don't I copy this object, and we'll do another one into the plugins, like so. Great. So, now our project has these settings that specify that the two paths, or folders, that we're working on, are the plugins and the themes. And now we don't have to see any of those other files that we'll never work with. So now, if I close out of sublime, if I want to go back to that project state, I go to Project>RecentProjects. And here's some that we have. I want the my-theme project. And now, we're ready to get started. But let's say that now, I want to switch to a different project. Well, it's really easy now. I can go to Project, Switch Project end Window or I can press Ctrl+Cmd+P. So, let's open that up, and let's switch to a snippets project that I am working on for another course. Now, that will immediately update the window with the folders for this project. And if I wanna go back one more time, My theme. Now we're back, and that took two seconds. Now, if at any given time, you need to update this project, bring up the palette, project, we're going to edit it. And maybe we'll do one more, because now you are going to be working with, I don't know, Themed 2010. Maybe you're gonna work with that theme, as well. Now, you have access to that. So, of course, this isn't for all situations, but it's possible for some frameworks, you would want to take advantage of this. And you can also take it further. And within these folders, exclude certain patterns. For example, maybe within 2011, you're a coder, and you're not ever going to be working on the stylings, you're just updating some of the files in this theme. Well, in that case, you really don't need to see those folders, or maybe you would. But this is just an example. So, why don't we add another setting here? And I'm going to specify file, exclude patterns. Now, within here as an array, we'll say we're going to exclude anything that ends in .css. So, now if I save it, take a look before, we have that style that .css file. But if I save it, and open this back up, now we're not displaying any file that ends in .css. Maybe the same thing is true, you have somebody who only works on the JavaScript, well, you could stick with file exclude patterns. Add another one. Start at js, and now if I open that again, you'll see that there are no files within the JavaScript folder. But you instead might prefer to exclude an entire file. And in that case, you would use folder exclude patterns. Here, I will pass an array, and we're going to exclude js, and maybe if there is a css folder, we'll exclude that one, as well. So now, we open this up, there's no reference to any .css files or JavaScript folders. Now, to finish off this lesson, what if your project has specific settings? Maybe you work on a JavaScript framework where the settings are to have two spaces for an indent. But then maybe you're working on a different language, and for that project, you're using four spaces. Well, we can apply these settings directly within this file. Let's add a new option for settings. And now, I will set the tab size equal to something really big just to show you that it's working. So, now you'll notice that for every single file within this project, we're using an indent of 20. Please don't ever do that, but you get the idea. But if we switch over to a different project, like this one, now that it's recognizing the spacing for that project, let's go back one more time, and change that to something, maybe like two. And remember, if you ever can't remember what the key should be, go to Sublime>Preferences>Settings Default. And here's where you can take a look. So, maybe for some reason, for your PHP project, you wanna add, I don't know, maybe a little bit of padding between the lines. All of that stuff is available to you. You should definitely have a look through here. There's tons of stuff. Well, now I can say for this project, I want the padding at the bottom to be maybe five. And now, each line, it adds just a little bit more padding. If I make that really big, you can see what I'm talking about there. So again, what's cool about this is when you're editing the settings user, that is going to be global for every project. But when you're in those instances where specific projects have unique requirements, this is the file where you would set those.

Back to the top