Roots Discourse

Files to upload to ftp


Which files and folders I have to upload to the FTP, after i run gulp --production?

Deploying Sage theme to shared hosting or any server

The dist/ folder. Ignore node_modules, bower_components, and assets


If you are handing this off to the client, then I would suggest also uploading the assets directory.


i have to upload all the files in the root? (gulpfile.js, bower.json, package.json,, readme ecc)


Nope. Pretty sure you can just whitelist the php files in the root


Wouldn’t you need the templates folder as well?


I use the following rules when syncing:


Oh yes this too. I should have just said “whitelist all your template files”


i know this is an old thread but it seemed the most relevant and I couldnt find an answer…

I am doing a client site which is on shared hosting hence I have to manually SFTP. Using he latest sage build too.

SO, which folder should i be uploading and which should I be missing?

Currently uploading the following:

app - all folders and file inside this directory
config - all folders and file inside this directory
dist - all folders and file inside this directory
resources - all folders and file inside this directory (i have a feeling  i shouldnt upload this as it contains all my sourcemaps!)
vendor - all folders and file inside this directory - is this required?

can someone please give some clrification? thanks in advance…


After running yarn build:production and composer install --no-dev, bare minimum you’ll want:

├── app/
├── config/
├── dist/
├── resources/                 # Notice the lack of assets/ within here
│  ├── views/                  # Blade templates
│  ├── functions.php
│  ├── index.php
│  ├── screenshot.jpg
│  └── style.css
├── vendor/                    # Composer dependencies
└──                 # Required (read it)

As I said, this is the technical bare minimum. It could be helpful to include the source/build files for whoever picks it up in the future. In my situation I want to encourage teammates to do things the right way (i.e. use version control for the codebase).

I have a bash script that I have run with yarn prep that builds for production and then packages these into an zipped folder, which I have labeled [theme-name]-distribute-[timestamp]-[commit hash]. It also includes some version details and instructions inside if someone stumbles upon the theme in the future. This allows me to stay sane whilst using FTP.

Prep script for Sage 9

Where yarn prep is yarn build:production && ./bin/ and ./bin/ is:


# Get theme name

echo "Preparing $theme..."

# Get short hash of current commit
hash="$(git rev-parse --verify HEAD --short)"

# Get timestamp
timestamp="$(date '+%s')"

# Create temp directory
mkdir -p $temp

# Copy relevant files to the the directory
cp -R {app,config,dist,resources,vendor} $temp  # Theme setup & config, views, theme files, composer deps, & repo
rm -rf $temp/resources/assets                   # Remove source assets
cp $temp                             # Copy Sage license (legally required)

# Create build(er) info and instructions file
printf "A theme by Example (\n\nCommit:   $hash\nBuilt at: $timestamp\nBuilt by: $(git config\n\n" > $temp/
cat bin/ >> $temp/

# Set distribute file name

# Compress distribution
cd .prep
zip -qr $dist "$theme-$timestamp-$hash"

# Remove temporary theme directory
rm -rf $theme

# Relocate distribution and current working directory
mv $dist ..
cd ..

echo "Finished!"

Probably could use some improvements, but it does the trick.

Transferring sage theme from local development environment to a live server

Thank you :slight_smile: super quick reply.

Thanks for the clarification. I have deleted files from resources (phew) and also uploaded the :slight_smile:

Issue sorted.

Nice little bash script. that will be super useful on the next build. currently, don’t have anyone else working on this project but the next one there will be so it will come in handy :-):grinning: