[TxMt] Persistent Includes?

Allan Odgaard throw-away-1 at macromates.com
Fri Mar 3 16:29:51 UTC 2006


On 2/3/2006, at 15:30, csilver_junk at mac.com wrote:

> [...] If nothing resembling Persistent Includes is available in  
> TextMate, another viable option would be to auto-generate the  
> output of an entire project but save it to a new directory on my  
> system using the same hierarchy of the original project [...]

I have no real idea about what the Persistent Includes can do, but it  
would be easy to create a TM command which e.g. pipes each *.php file  
in your project through PHP and wrote the result to an “html” sub- 
directory (as an HTML file):

    cd "${TM_PROJECT_DIRECTORY:-$TM_DIRECTORY}"
    mkdir -p html
    for f in *.php; do
       php <"$f" >"html/${f%.*}.html"
    done

This would allow you to use all the power of PHP and create static  
files from that. You could add a master.inc which got sourced when  
generating each of the files, e.g. like this:

    cd "${TM_PROJECT_DIRECTORY:-$TM_DIRECTORY}"
    mkdir -p html
    for f in *.php; do
       cat master.inc "$f"|php >"html/${f%.*}.html"
    done

That way you could place shared variables and such in your master.inc.

FYI the TextMate manual is generated in a slightly similar fashion,  
see http://lists.macromates.com/pipermail/textmate/2006-February/ 
008160.html for more.




More information about the textmate mailing list