Pre-export script in addition to the post-export one

In advanced export settings, we can indicate a script that will be run after export. It could be useful to have the opportunity to do the same before the export : so a pre-export process in addition to this post-export one. For example, in my case, I prefer to start from an empty export directory at every export (to avoid keeping eventual old/obsolete files in the tree) and it would be easier if I could just delete it through a script of mine at pre-export stage.

1 Like

+1 :+1:

I do that quite often for my big sites as well. I’d like to extend this request a little further to have the option to do this pre-publish as well (publishing to non-bss hosting for my needs). Would be great if it was an easy to access (since it would be used quite often) toggle to use as wanted/needed.

Thank you for the suggestion! I see how a pre-export script can be useful for cleaning up the directory before exporting, but I am not sure what else it could be used for. Maybe an export option for emptying the folder would be a better solution than a script?

If you wish to empty a folder on your server, it may be complicated to do it with a script. Having a toggle so that the app does it automatically will be easier. It can be quite dangerous though - if you mistype your website directory path you may nuke all sites in your hosting account.

Martin, just assume that some of us are adults and know what they doing. It’s like you’re banning knives from being sold because people could get hurt with them. You or the program are not responsible for user scripts. If we want, we can also delete anything in the export script. It’s just about creating possibilities. If there are concerns, then gladly as an advanced mode and if necessary with a warning. But don’t prevent innovation because you want to protect someone who doesn’t want to be protected.


For my own case, a simple switch to erase previous export content before a new export would be enough, but I extended the principle to a script call since I’m not necessarily aware of all the needs other people could have… This said, as you say to @jo-r, it could lead to a dangerous situation, but BSS is supposed to be used by skilled people (otherwise, we have Wix LOL); meaning, we can make mistakes, but we have backup of anything ^.^ When you use an IDE like CodeBlocks for example, you have the possibility of pre and post-build steps, then you could run any possible command, even a “rm -rf” against a precious path… Well, however, for me an “Erase previous export” before export would be a nice first step!