with Imagination: by Dustin Diaz

./with Imagination

A JavaScript, CSS, XHTML web log focusing on usability and accessibility by Dustin Diaz

Textmate “page” snippet

Monday, February 26th, 2007

For any avid Textmate (or E) user, you might (or might not) find this little snippet useful when prototyping out a quick page and all you need is the barebone requirements of simple html page. It can be edited to suit your needs. Simply add this as an HTML snippet, and assign the tab trigger “page” (or whatever else you want to call it). Here it is:

HTML page template snippet

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en">
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>${1:Title}</title>
        <style type="text/css" media="screen">
        <!--
        body { background:#111;color:#fff;font:12px tahoma,'trebuchet ms', sans-serif; }
        h1 { font:300% georgia,times,serif; }
        -->
        </style>

        ${2:${3:<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.2.0/build/reset-fonts-grids/reset-fonts-grids.css" />}
        ${4:<script src="http://yui.yahooapis.com/2.2.0/build/utilities/utilities.js"></script>}

        ${5:<script src="http://yui.yahooapis.com/2.2.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>}}
        <script type="text/javascript">
        <!--
        $0
        //-->
        </script>
    </head>
    <body id="${6:page}">
        <div id="doc">
            <h1>$1</h1>
        </div>
    </body>
</html>

Keep in mind, this was tailor made for mwah (that’s me). So by all means, tailor it to your own needs. Cheers.

15 Responses to “Textmate “page” snippet”

  1. justin

    Why not…
    http://www.w3.org/TR/xhtml1/#h-4.8

  2. justin

    To get back on topic, why do you prefer this method of creating a new blank page over the built-in “New from Template”?

  3. Dustin Diaz

    justin, what does it matter which doctype you use. Just use one (or don’t). I think you’ve missed the point. The key benefit is also that you just use it as a tab trigger.

  4. Remy Sharp

    Not to be too picky, but since you’ve declared your DocType as strict, you should really add the ‘type=”text/javascript”‘ attribute in the

    <script src ...

    tag to make the page validate.

    Cheers for the snippet.

  5. Dustin Diaz

    Or maybe I should change the doctype to HTML 4.01. That would probably be better fit for me.

  6. Jesper Haug Karsrud

    Nice snippet, Dustin. I created a snippet almost like this one for Intype, and I really find it useful when I need to do something really fast. :)

  7. justin

    Take it easy Dustin, you’ve got expect stuff like that when you’re a well-known blogger in the XHTML/CSS/Web Standards community.

    I’m sure you have your reasons, just wondering what they are (just like Remy Sharp in another comment).

  8. Will Green

    Your Javascript includes are redundant (yahoo-dom-event is already inlucded in utilities). From the README for utilities in the latest YUI release:

    The utilities.js file rolls up all of the YUI utility components into a single
    file; it includes the following components:
    
    * Yahoo Global Object
    * Event
    * Dom
    * Connection Manager
    * Animation
    * Drag & Drop
    
    For implementations that use a significant subset of these files, it may prove
    more efficient to include utilities.js as opposed to including separate files
    for each component.
    
    Note: If you are require only the Yahoo Global Object, Event Utility and Dom
    collection, consider using the special yahoo-event-dom.js aggregate instead.
    
  9. Dustin Diaz

    @Will: I definitely of most people know that. It was purposely done for the sake of choosing which ones I want. If you look at the snippet itself, it tabs over each and hilights the block. I generally end up using one or the other. But never both.

  10. Jason Beaird

    I’ve been working on a PC lately and E doesn’t have all the features of TextMate, so this may come in handy for me now that I don’t have “New from Template” available.

  11. Paul Armstrong

    font:300% georgia,times,serif;

    Are you going blind there?

  12. Matt K.

    I’ve been using E for a while and it’s pretty cool. It’s not a ‘Textmate replacer’ by any means but it’s the closest thing on a PC for right now.

  13. Rob Ellis

    E is pretty good, but ‘the closest thing on a PC’ - Check out Intype (intype.info)

    Rob

  14. Dustin Diaz

    Hi Rob,
    I have to disagree since I tried out Intype first before even discovering E. E is well ahead of where Intype stands.

  15. Rob Ellis

    While I don’t want to go too far off topic, I do agree that E is ahead of Intype and I think there is room in this space for more then one player. This thread sums up some of the differences -
    http://intype.info/forums/discussion/329/intype-vs-e-text-editor

    Rob

Leave a Reply

Phone Number:

If you're about to post code in your comment, please wrap your code with the tag-combo <pre><code>. Also please escape your html entities - otherwise they will be stripped out. I recommend using postable.

Get "JavaScript Design Patterns"

"As a web developer, you'll already know that JavaScript™ is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power waiting to be unlocked--JavaScript is capable of full object-oriented capabilities, and by applying OOP principles, best practices, and design patterns to your code, you can make it more powerful, more efficient, and easier to work with alone or as part of a team."

Buy JS Design Patterns from Amazon.com Buy JS Design Patterns from Apress

Flickr

Submit a Prototype

All content copyright © 2003 - 2007 under the Creative Commons License. Wanna know something? Just ask.

About | Archives | Blog Search

[x] close

Loading...

Submit a prototype

By checking this prototype I agree that I am not submitting false credentials, pornography, or a hate crime website. I also understand that by submitting my entry I may or may not be accepted, and if accepted, my entry may be taken down at any given time if I violate these terms.