Better Export Functionality [added in 2.4.2]

Forums Ideas Better Export Functionality [added in 2.4.2]

This topic contains 27 replies, has 10 voices, and was last updated by  ta1db 5 months, 2 weeks ago.

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
  • Martin Angelov
    Bootstrap Studio Developer

    The new export functionality was added to version 2.4.2, which we released yesterday. It supports remembering export destinations, minification and using CDN for jQuery, Bootstrap and the icon fonts.

    After much deliberation, we decided that there is an impossible number of different transformations that people might require from the export. This is why instead of building a similarly complex interface to customize the file paths, we made something better – the ability to configure an Export Script, which is called after every export. This is more involved, as it requires writing code, but gives you a lot of control. You can write the script in any language. For Linux and macOS it should be marked as executable (+x).

    For example you can write a script like this in bash to rename a specific file from .html to .php:

    cd $1 # the export path is passed as the first argument, which is why we cd there
    mv index.html index.php

    Similarly, you can move images to external folders, replace parts of your generated code, optimize your images and more. It all depends on what you are able to do with your script.


    Hiya Martin,

    Although this all sounds great, I’m not a programmer at all so this coding stuff is a bit lost on me. Will there be support examples to help those of us that are not programmers to create various scenarios to get us started?


    I could even do something like copy to my server via ssh!

    @jo – There’s lots of script help available on Google for this kinda stuff, you’ll find it rather trivial to make complex stuff happen with this addition! This is the right solution for this application!

    @martin – maybe you can make an online snippet section like components that people can install or copy / paste. Like “Export as PHP”, and it just works for people. “Export as ASP”, etc.


    Thanks Andrew, I’m sure there are a ton of places on google, but …. I would have to know what to search for to do that lol. As I said, I’m not a programmer, so I have no clue what language I’m looking at in many cases. Working on it, but it’s a time consuming process for this old brain so it will be a while before I’m anywhere near using it lol. I like the idea of the Snippet section though, that would definitely make a difference.

    Other than exporting to specific locations in a directory, I don’t even know what I’d have a need for this for at this time lol. I think right now it would only be used for setting the export directory of specific folders (js, css, etc.) into the root directory rather than within the assets directory.

    I have to say one thing on this though. I’m finding it more and more convenient to have the files where they export lol. It’s more the importing of them that’s giving me grief than the exporting lol. Thanks for your suggestions though Andrew. 🙂


    I would assume that those of us with win10 anniversary update would need to install the Linux Bash Shell for win10 so that we could use the bash example as stated?

    How to Install and Use the Linux Bash Shell on Windows 10

    I am also one that doesn’t know this method of scripting. I had tried making a .sh file with the above example to no avail. Any direction would be helpful.


    • This reply was modified 2 years, 8 months ago by  Saj. Reason: wording
    Martin Angelov
    Bootstrap Studio Developer

    I gave Bash as an example, as this is the most basic way of scripting things on Linux and macOS. Windows doesn’t have bash installed, so you will need to write scripts using a different language. You can write scripts using CMD.exe (called Batch files). Here is an example. They have different commands and syntax than the code I wrote above. Another built-in alternative is PowerShell, but I don’t have experience with it.


    Ok so after several attempts on figuring out some powershell and or .bat usage, I find that I am limited based on security being able to run scripts on my work system. I tried running a .bat file that would execute a .ps1 file and would get security errors.

    So I’m not going to go into how to subvert your windows OS security just to allow running these scripts as the potential danger and risk to making a very powerful tool automated and leaving your PC vulnerable.

    So I have come away with doing this for me in win10 and using powershell. For now I won’t use the Advanced part of the export function of the BSS app.

    Click start and for win10 just start typing in powershell, select “Windows Powershell” from the list. I right clicked it and pinned it to the task bar so I can launch it from there.

    In powershell I’m going to use the following command (I haven’t figured out the method to change directories and execute this in a single process)

    Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$ -replace 'html','shtml'}

    This command generally does the following based on how I understand it.

    1. Get all child elements with the file name .html [the asterisks is a wildcard character meaning any/all files with the “.html” extension]
    2. Recurse – find all files from with in the root AND sub folders, root is the current folder that powershell has as the command line
    3. Rename some items with a new name
    4. Replacing the [first value] with the [second value]

    So you will need to use DOS/batch style commands to get to the appropriate directory in order to execute it.

    If you are exporting to a network drive, it will be easiest to MAP the network drive first. Preferably the folder that is the root for your export. I will use “T:\bss_export” for example.

    Once you start Powershell it most likely starts with the command line of PS C:\Users\[your username]

    Using the networked drive example

    1. type in cd "T:" (hit enter) (I mapped my network drive to T)
    2. if it’s a subfolder type in cd "bss_export" (hit enter) (I had a subfolder for test)

    The Powershell commandline would look something like this for me PS T:\bss_export

    If like me I need to change all the .html exported extension to .shtml then copy/paste in this command and hit enter

    Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$ -replace 'html','shtml'}

    For people that need to switch some of your files to .php then I think this would do for you. Before you export, rename the files you want to be php files by including “_php” in the file name before the .extension

    So that you could then use these 2 commands.

    Get-ChildItem -Filter "*_php*" -Recurse | Rename-Item -NewName {$ -replace 'html','php'}
    Get-ChildItem -Filter "*.php" -Recurse | Rename-Item -NewName {$ -replace '_php',''}

    First command will rename files that contain _php in the name it will rename it to a .php file then the second command will find those .php files and rename the file by removing the _php wording in the file name.

    A Big thing here is that this does not replace/overwrite existing files.

    I haven’t figured out a way for that.

    You could try the following below but I think I will export to a holding area rename the files like above and then move them where I need them.

    <hr />

    I could use these 2 commands to work around that BUT I would have to be sure that any editing is done in the BSS app not after because this will delete the old file.

    Make my edits in the BSS app not outside it then export then run powershell etc and run this command to remove all files.

    Get-ChildItem *.shtml -Recurse | Remove-Item

    Then I could run this to get back to the correct file .extension

    Get-ChildItem -Filter "*.html" -Recurse | Rename-Item -NewName {$ -replace 'html','shtml'}

    I’ll look into .bat file commands and see what I can up with for that.



    Hi Saj,

    take Linux… then you will have less problems. (e.g. (its an Ubuntu and Debian System and easy to use))

    I quit with MS at the point of Windows 8. With Windows 10 and all its System integrated Spyware my hole company stops any MS-Support.

    Take Linuxmint, with an VirtualBox ( running Window7 and Comodo Internetsecurity on it. Then you can run some special Windows-Software if this not available in Linux.

    I am trying to make an Linux-Script for the things you need, because I need them, too, but I need some time before its ready to share


    Thanks Frank,

    Unfortunately it’s a work PC and totally out of my control for most things like that. It’s not a problem for me to export in a staging area of sorts because I still need to do a bunch of post editing as it is anyways with all the snippets I need to make and putting in programming tags etc…

    I do appreciate all the info though 🙂



    +1 to Franks comment. This is biting me often as I have numerous projects and they each have their own export location.


    My post didn’t show up where I thought it would. I was also voting for the ability to have the export destination be a project-level setting rather than a a global setting across all projects.


    Hiya Jeff0401,

    Project specific export settings have already been added to the app. Click the button and if you do not have a location set up it will ask you for one. That will happen for each project. Enjoy! 🙂


    For those having difficulty in running .bat files as export script in windows I would recommend (as an alternative among other possible solutions) to write a simple python script like this:

    import os
    import sys
    os.system('copy index.html index.php')

    and make this python script an executable (.exe) file with py2exe as explained here py to exe in windows It worked quite fine in my system (win 7).

Viewing 13 posts - 16 through 28 (of 28 total)

You must be logged in to reply to this topic.