Using the command line

Tome comes with a few Drush commands which export and import content, and generate static HTML.


The export command will delete and regenerate all your config, content, and files based on what's currently on your local machine. Ideally you would only run this once when you first start using Tome, then from that point on rely on the automatic syncing feature to keep your codebase up to date. That said, if you've automatically done something like a "git reset --hard" locally and lost your changes, a fresh export will save your work.


The import command should be run after every fresh Drupal install, or otherwise at the start of each local editing session. All your local install's config, content, and files will be replaced. While it is possible to run this command after the site has been installed, for example after a "git pull", it's recommended that you always start with a fresh install.


The import partial command only imports content and config that has been modified, added, or deleted. If you already have an installed site this command should be all you need as you pull in changes or check out new commits.


The static command exports static HTML to your export directory, which is usually a root-level "html" folder. On a large site with a lot of paths this can take awhile, so a progress bar is included to keep everyone sane.

If you want to review your static site after running this command, you can pass the "--run-server" option, which will automatically open a local server and browser tab, similar to how "drush runserver" works.

All builds are cached by default. If you have pages that don't quite work with cache, you can set the "tome_static_cache_exclude" option in your settings.php file. See Site settings for more information.


The preview command runs a simple local server that lets you preview your static site.


The clean-files command looks for files that appear to be unused by any other config or content entity, and prompts the user to delete them. This command exists because Drupal has some issues with old files sticking around after they stop being referenced. Traditionally this has been solved with a mechanism called file usage, but that system isn't super reliable in complex setups. In the future an automatic garbage collection mechanism for files will be built into Tome, but for now you should run this command every now and then to clean up your repository.

Improving performance

As sites grow larger and more and more entities are created, these commands will start to slow down pretty quick. To address that, many commands accept a "--process-count" option, which determines the maximum number of processes to invoke while doing a task. The import and export commands include a "--entity-count" option, which determines how many entities each process should process. The static command includes a "--path-count" option, which determines how many paths to export per process.

Every site and local environment is different, so it's up to you to tweak these values to suit your use case. I've found that SQLite has some problems with concurrency, so for import and export it may be best to bump up the entity count option before touching the process count.

Concurrency is going to help out large sites a lot, but there are other things you can do to speed up your local environment. Some options are:

  • Increase PHP's memory_limit setting in your php.ini file to avoid running out of memory in each process.
  • Instead of using SQLite, try using something like MAMP or Acquia's Dev Desktop to run a more traditional stack with MySQL. This can avoid deadlocks and improve performance.
  • Use a container for all your development to keep the environment consistent across team members.
  • Create a continuous delivery job which automatically generates static HTML on commit.

Good luck!