[TxMt] how does the html bundle preview a document with unsaved changes?

Stephen Bannasch stephen.bannasch at deanbrook.org
Sat Sep 7 02:34:18 UTC 2013


I trying to add the ability to run jshint on a document which has changes that haven't been saved to the filesystem to the jshint.tmbundle bundle:

   https://github.com/fgnass/jshint.tmbundle

I wondered if there was a way to have textmate make a tmp file of the current document so I could pass that file in a command line invocation of jshint.

I was also checking out the Preview command in html.tmbundle and noticed that if I saved a file, added some text and ran Preview without saving the preview showed the new html content.

The code in the "Show Web Preview": command is pretty simple but it's not at all clear to me how it works to accomplish this:

https://github.com/textmate/html.tmbundle/blob/master/Commands/Show%20Web%20Preview.tmCommand#L9-L12

   #!/bin/sh
   if [[ -e "$TM_FILEPATH" ]]; then
	echo "<base href=\"file://$TM_FILEPATH\">"
   fi
   cat

Does anyone have any suggestions of perhaps another bundle I can look at which does something like this?

FYI: this is the current command that invokes jshint in jshint.tmbundle:

https://github.com/fgnass/jshint.tmbundle/blob/master/Commands/Save%20and%20Hint.tmCommand#L8-L13


More information about the textmate mailing list