While anyone can download and install Tome on a new or existing Drupal site, it works best when used with specific Drupal configurations. This guide will take you from creating a new site to making your first commit.
Before continuing, it’s expected that your local machine has:
- PHP 7 or greater installed.
- Composer installed globally.
A global Drush installation is not required to use Tome, but is easier to use than typing “./vendor/bin/drush” every time you want to run a command. This guide will assume that the “drush” command is available.
To start, create a new instance of the starter project by running:
composer create-project drupal-tome/tome-project my_site --stability dev --no-interaction --no-install cd my_site composer install git init git add . git commit -m 'Initial commit of starter codebase.'
The starter kit only comes with Drupal core, so you’ll probably need to install contributed themes and modules as well. Eventually the starter kit will come with a Tome-specific distribution, which will be the recommended way to make simple sites. Since Tome is still in development, things are bare-bones for now.
Next you’ll need to initialize your site by choosing an install profile. Run:
I would recommend using the "Standard" profile when prompted, since it comes with a default theme and content types. If you installed Standard, you will probably want to uninstall the modules that don't make sense for a static site. To do this, run:
drush pmu search history contact -y
If you run “git status” at this point, you should see that the “config” folder is full of exported configuration. You’ll want to commit those changes now so you have a base to work off of in your history. Run:
git add . git commit -am 'Installed the Standard profile.'
Next you’ll need to start up a local webserver. In a new tab, run:
cd [path to your my_site codebase] drush runserver 127.0.0.1:8888
Then switch back to your original tab, and run "drush uli -l 127.0.0.1:8888"
A browser window should pop up and log you in as admin.
Now you’re ready to start using Drupal to build you site. Let’s start by adding a new article. Expand “Shortcuts” in the admin toolbar, click “Add content”, then “Article”. Fill out the fields to your liking, and make sure to upload an image.
Once your article has been created, go back to your command line window and run “git status”. You should see that two new files exist in the “content” directory, one for the article node you made, and one for the file you uploaded. There should also be a copy of your uploaded file in the “files” directory. Feel free to commit these files now if you’d like.
Tome is always watching your site for changes, and automatically syncs modified config, content, and files as needed. Running “drush tome:export”, which exports everything currently on your site, should be pretty rare after your initial install.
We’re going to test that your site can be fully rebuilt from scratch, to ensure that everything is working properly. Run:
If you visit your site again, you should see that your article and image as they originally appeared.
Even though your site doesn't have much going on yet, let’s test the static site generation as well. Whenever you’re ready to generate static HTML for your site, run:
This should put a copy of your site in the “html” directory, which you can then upload to a host of your choosing.
That's it for now. You're free to start making your Tome site. Make sure to check out the other documentation, and keep in mind that the project is still in development. Thanks!