[TxMt] Re: Multiple file Template

Alastair Moore alastair at kozmo.co.uk
Wed Dec 6 21:35:05 UTC 2006


On 6 Dec 2006, at 21:09, Alastair Moore wrote:

> This creates the HTML file but not the CSS file. Or at least it  
> didn't until I reloaded the bundles and discovered "untitled.css"  
> had appeared in the template file list alongside html_in.html and  
> css_in.css. Very odd! I did some more reading and found a post in  
> the mailing list archives (http://article.gmane.org/ 
> gmane.editors.textmate.general/8424/match=templates+multiple+files)  
> which Allan mentioned I need to edit an info.plist file.  
> Unfortunately I've not been able to find this file anywhere. Could  
> anyone suggest where it might be and what I need to edit?
>

Ok I've found what I'm supposed to edit and where, and it works fine  
for two files but not for more than that.

My template code now looks like -

TM_MASTER="$TM_NEW_FILE_DIRECTORY/master.css"
TM_STANDARD="$TM_NEW_FILE_DIRECTORY/standard.css"

if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then
    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' <html_in.html >"$TM_NEW_FILE"
    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' <master_in.css >"$TM_MASTER"
    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' <standard_in.css  
 >"$TM_STANDARD"
fi

and the info.plist looks like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// 
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>command</key>
	<string>TM_MASTER="$TM_NEW_FILE_DIRECTORY/master.css"
TM_STANDARD="$TM_NEW_FILE_DIRECTORY/standard.css"

if [[ ! (-f $TM_NEW_FILE || -f $TM_HEADER) ]]; then
    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' <html_in.html  
>"$TM_NEW_FILE"
    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' <master_in.css  
>"$TM_MASTER"
    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' <standard_in.css  
>"$TM_STANDARD"
fi
</string>
	<key>extension</key>
	<string>html</string>
	<key>files</key>
	<string>printf "$TM_NEW_FILE\n$TM_NEW_FILE_DIRECTORY/master.css\n 
$TM_NEW_FILE_DIRECTORY/standard.css"</string>
	<key>name</key>
	<string>Two Column (left)</string>
	<key>uuid</key>
	<string>8C48A8D2-9526-4467-93CB-92C08AFC65F5</string>
</dict>
</plist>

It creates the HTML file and the master.css file but not the  
standard.css file. Not sure why! Any help would be well appreciated  
and if anyone can suggest a way I can force the css files into a  
subdirectory, that would be even better :)

Many thanks guys,

Alastair




More information about the textmate mailing list