Work with LiveSite Components ‘Offline’

8 August 2008
by Billy Czajkowska

If you are developing LiveSite components in a shared environment, the chances are high that your editing will be interrupted by other users performing builds. To get around this you can bypass the online environment, and access the component files direct.
1) Use Samba or a tool such as FileZilla to access the component files. If you are using FileZilla, set the editor to VIM.
2) Select “view/edit” in FileZilla to access each LiveSite component.
3) The component file is very difficult to read as the XSL code has amongst other things,  < and > replaced with < and >
4) To remedy the above, add the following functions and menu options to your VIM environment :-
” Make a LiveSite component more readable
func MakeComponentReadable()
%s/</<|/g
%s/>/|>/g
%s/</</g
%s/>/>/g
%s/ /<cr/>/g
set syntax=xml
1
endf
” Restore a LiveSite component back to it’s original state prior to uploading
func RestoreComponent()
%s/<cr/>/ /g
%s/([^|])>/1>/g
%s/<([^|])/<1/g
%s/<|/</g
%s/|>/>/g
set syntax=
1
endf
amenu one.Make LS Component Readable :call MakeComponentReadable()<CR><ESC>
amenu one.Restore LS Component :call RestoreComponent()<CR><ESC>
5) The first function adds readability to the component file, whilst the second is used to restore the standard component formatting once your editing is done, and you are ready to upload the component back to the LS environment.

Our Latest News