- Overview
- Transcript
5.3 Quicker Stylesheet References
This lesson will demonstrate a quick tip on how to easily copy the current file as both an anchor tag and stylesheet/script reference. It's a small, but helpful trick!
1.Introduction1 lesson, 02:05
1.1Welcome02:05
2.Getting Started9 lessons, 35:20
2.1Installation and Base Settings04:54
2.2Services and Opening Sublime From the Terminal02:20
2.3Multiple Cursors and Incremental Search06:54
2.4The Command Palette04:13
2.5Instant File Changing03:19
2.6Symbols04:17
2.7Key Bindings02:33
2.8Installing Plugins Without Package Control02:54
2.9Package Control03:56
3.Snippets3 lessons, 14:40
3.1Your First Snippet09:04
3.2Adding Snippets Through Package Control02:32
3.3Easier Testing With Snippets03:04
4.Essential Plugins12 lessons, 46:58
4.1Zen Coding07:09
4.2Emmet06:52
4.3Cross-Browser CSS With Prefixr02:17
4.4Fetch Files With Ease 04:22
4.5Lightning Fast Folder and File Creation 02:12
4.6Sidebar Enhancements03:09
4.7Sublime Linter02:01
4.8Sexy Code Snippet Management With Gists07:50
4.9DocBlockr03:49
4.10Pretty Task Management02:42
4.11HTTP Requests Within Sublime02:29
4.12LiveReload02:06
5.Tips, Techniques and Modifications8 lessons, 49:09
5.1Regular Expressions in Sublime05:49
5.2Vintage Mode10:46
5.3Quicker Stylesheet References02:30
5.4Joining Lines04:40
5.5Sublime and Markdown with Marked03:10
5.6All About Projects 05:54
5.7Configuring and Mastering Split Windows07:19
5.8Custom Builds09:01
6.Closing1 lesson, 00:49
6.1Conclusion00:49
5.3 Quicker Stylesheet References
Consider this fairly common process. I have some boiler plate code here and I need to add a style sheet. So you either right-click on CSS and choose a new file or if we have the side bar enhancements plugin installed, which I already covered in this course, I can hit option, command, N and type CSS/style.CSS. So now we have created this style sheet. The next step is a tedious one. You have to go back to your main page and include a reference to it, [BLANK_AUDIO] like this. So, granted, that doesn't take a long time, but it is a tedious process nonetheless. Well, Sublime Text can make this slightly easier on us. Now it's not as easy as, for example, Text Mate where you can just drag the file into the editor and that will automatically generate the reference. That's a very cool feature. Sublime Text does not have that. But it does have the ability to copy the relative path to the current file. So let's go back to the step where we created style.css. If I hit Shift+Cmd+P and I choose copy notice that it brings up these options here. Copy Name, well that will produce the name of the file. If we run Copy Path. That's going to give you the full path from your computer's root to the file. But most of the time you're going to want the path relative to the root of your project. And in that case we do Copy Path from Project. And now we have a relative path. Now we can make this better but for now this can be very helpful. You could then go back to index at HTML. You can add a link, and use Cmd+V to paste it in. And that's a little bit easier. But, we can go one further with Sublime Text. If we come back, I can also run Copy as Tag a, which would create an anchor tag. Paste that in, now you have an anchor tag to that page. Or, we can do as a tag style, and that will generate the necessary link tag, which you can then, of course, paste into your project. So I wish it didn't add the type equals text/css, but I'm sure we could root around the back end and find a way to remove that if we needed to. Altogether, it's not that big of a deal. So let's go through the process one more time. We will hit Cmd+Option+N. We're gonna create a new file called module.js. Now we're gonna copy this as a script, and we'll come back, paste it in at the bottom, and we're done. So it's not the easiest option, but that still is pretty flexible.