[TxMt] Re: Options for real time css develpment

Scott Haneda talklists at newgeo.com
Tue May 5 22:25:33 UTC 2009


On May 5, 2009, at 7:59 AM, Anthony Park | 29degrees wrote:

> Scott Haneda wrote:
>> Any suggestions to get out of the change/save/switch/reload cycle
>> that is going to give me carpal tunnel syndrome soon enough.
>
> One option, which is obviously completely editor-independent, would be
> to set your browser to refresh the page at regular intervals (for
> example, once a second) whilst you're working on it. Firefox has an
> extension [1] which will do this for you, and you could do the same
> with Safari with AppleScript.

I have thought about this, and tried it, I think it had issues.   
Firstly, every load in safari seems to be another 1MB of memory is  
sucks up, this was killing me.  I also think there was an issue with  
focus, Safari kept getting in my way.

> I'd be interested to hear if you come up with any other solutions.


Something just kicked into my head, I remembered the base href meta  
tag.  I downloaded a index.html file from a random site, and as the  
first tag in the head section, I set the base href to the sites domain  
path:

<base href="http://example.com/" />

All of a sudden, the css file and images all came alive, all links  
worked.  So this given me my local file to work on, all I would have  
to do is download my .css files and what I want would be  
accomplished.  I could then use the web preview feature in TM.

I could even take it one step further, and use a remote ftp app, set  
the base href, and all css and image files would work.  So this solves  
it to a degree.   The web preview in TM is not perfectly responsive,  
but it does work, and this makes all .css files followed even the  
@included types.

The last one I was thinking, is a bundle item.  I little more work,  
but more transparent.  Make a bundle item that will curl a url, grep  
for all urls and download them to /tmp/random_folder.  Find the css  
bits and files you want, and generate a project plist file in /tmp as  
well.

Pass the path to the project file to TM to be opened, and there you  
are, you just were asked for a url, and given back a TM project you  
can edit and work on locally.  You still have the issue of editing a  
css file not being able to refresh the web preview of the parent html  
file.

This is probably only going to be truly solved in TM core, at least in  
a graceful way. So far, not a lot of demand given the lack of replies  
on this thread.  Maybe it could be done in a plug-in, I have no idea.

Right now, I am pretty pleased with the base href idea, that works  
amazingly well actually.  It is a tag I forgot about, never really had  
a need for it.  There is also <base target="_blank" /> which could  
come in handy, but I usually just find and replace those away.
-- 
Scott * If you contact me off list replace talklists@ with scott@ *




More information about the textmate mailing list