You are here

README.txt in Tome 8

ABOUT TOME
==========

Note: For the most up to date documentation, visit https://tome.fyi/

Tome is a static site generator, and a static storage system for content.

When you use Tome, everything about your Drupal site is stored as files. There
is no persistent SQL database or file system, and the only time Drupal is
running is when you’re using it locally. As you locally edit content, your
changes are automatically exported to the filesystem and ready for commit. Once
committed and pushed, others can pull your changes down and build a fresh site
that looks exactly as it did on your local machine. When the repository is
looking good, you can generate the static site and ship it to production.

INSTALLATION
============

When you use Tome on a new or existing Drupal site for the first time, you'll
want to do an initial export of your config, content, and files. To do this,
run "drush tome:export". You should probably commit this as well.

When you need to re-install Drupal, run "drush si <profile> -y", then run
"drush tome:import -y".

CONFIGURATION
=============

Tome uses settings to determine where to export. The settings you can configure
in settings.php are:

 - tome_files_directory: Where files are exported. Defaults to ../files
 - tome_content_directory: Where content is exported. Defaults to ../content
 - tome_static_directory: Where HTML is exported. Defaults to ../html
 - tome_book_outline_directory: Where books are exported. Defaults to ../extra
 - tome_static_cache_exclude: An array of paths to always exclude from cache.
 - tome_static_path_exclude: An array of paths to exclude from static site
   generation. Useful for system paths.

Config is exported to your config sync directory. It's recommended that you set
this to "../config" with a settings.php line like:

```
$config_directories['sync'] = '../config';
```

USE
===

In general, you should not need to run tome:export after the initial install.
Any edits to config or content will be automatically synced to your output
directory.

There is a special Tome command, "drush tome:clean-files" that will delete any
files that appear unused. This is a temporary workaround to a systemic Drupal
issue with file usage and automatic deletion.

When your site is looking good and ready for production, you can export static
HTML. To do this, run "drush tome:static". From there you can upload your HTML
files to any web hosting provider.

USING SUB-MODULES
=================

Tome is split into two sub-modules that are automatically installed when you
install Tome. Depending on your use case, you may want to install and use them
separately:

 - Tome Static: The Tome Static sub-module handles static site (HTML)
 generation, and is useful if you are comfortable with your existing Drupal
 stack, but still want to run a static site on production.
 - Tome Sync: The Tome Sync sub-module handles static content export and
 import, and is useful if you want to build your site from scratch, or prefer
 to work with your content as JSON.

See https://tome.fyi/docs/sub-modules/ for more details.

IMPROVING TOME STATIC PERFORMANCE
=================================

For Tome Static users who have run into performance problems like:

 - Clearing all cache in the UI or with "drush cr" completely wipes Tome Static
 cache.
 - Views uses list cache tags (i.e. node_list) which means that any node save
 results in all Views having their cache cleared.

There is a sub-module available, "Tome Static Super Cache", which changes core
caching behavior to improve Tome Static performance.

Enabling the sub-module will generally improve Tome Static performance, as it
will start ignoring certain cache tag invalidation and prevent Tome Static
cache from being wiped when rebuilding cache. To fully rebuild cache with the
module enabled, you can click the "Fully clear caches" button at
`/admin/config/development/performance`, or run "drush tscr".

Tome Static Super Cache also provides a Views cache plugin ("Smart tag based")
that does not use list cache tags, which should be used on all Views that it
works on. This plugin partially executes all Views on entity create/update, and
determines if that entity would show up in the View. If so, a custom View
specific cache tag is cleared.

RUNNING TOME STATIC ON CRON
===========================

If you're running a persistent Drupal site and want to generate a static site
with cron, you can enable the tome_static_cron sub-module, which queues all
uncached paths when cron runs and works through them until the cache is full.

To use tome_static_cron, install the module then visit
/admin/config/services/tome_static_cron/settings to enter the base URL to use
for static cron generations.

MODIFYING TOME SYNC FILE HANDLING
=================================

By default, when file entities are exported, imported, or deleted, Tome Sync
will keep the file export directory and your public file directory in sync by
performing copies or deletes.

This may not be desirable if you prefer to just symlink your files directory
to a directory tracked by Git, or do not want to track files in Git at all and
prefer to use persistent storage.

In those cases, you can override the file handling service to use an alternate
class that does nothing on file sync operations. To do this, add this block of
code to your per-site services.yml file:

```
services:
  tome_sync.file_sync:
    class: Drupal\tome_sync\NullFileSync
```

File

README.txt
View source
  1. ABOUT TOME
  2. ==========
  3. Note: For the most up to date documentation, visit https://tome.fyi/
  4. Tome is a static site generator, and a static storage system for content.
  5. When you use Tome, everything about your Drupal site is stored as files. There
  6. is no persistent SQL database or file system, and the only time Drupal is
  7. running is when you’re using it locally. As you locally edit content, your
  8. changes are automatically exported to the filesystem and ready for commit. Once
  9. committed and pushed, others can pull your changes down and build a fresh site
  10. that looks exactly as it did on your local machine. When the repository is
  11. looking good, you can generate the static site and ship it to production.
  12. INSTALLATION
  13. ============
  14. When you use Tome on a new or existing Drupal site for the first time, you'll
  15. want to do an initial export of your config, content, and files. To do this,
  16. run "drush tome:export". You should probably commit this as well.
  17. When you need to re-install Drupal, run "drush si -y", then run
  18. "drush tome:import -y".
  19. CONFIGURATION
  20. =============
  21. Tome uses settings to determine where to export. The settings you can configure
  22. in settings.php are:
  23. - tome_files_directory: Where files are exported. Defaults to ../files
  24. - tome_content_directory: Where content is exported. Defaults to ../content
  25. - tome_static_directory: Where HTML is exported. Defaults to ../html
  26. - tome_book_outline_directory: Where books are exported. Defaults to ../extra
  27. - tome_static_cache_exclude: An array of paths to always exclude from cache.
  28. - tome_static_path_exclude: An array of paths to exclude from static site
  29. generation. Useful for system paths.
  30. Config is exported to your config sync directory. It's recommended that you set
  31. this to "../config" with a settings.php line like:
  32. ```
  33. $config_directories['sync'] = '../config';
  34. ```
  35. USE
  36. ===
  37. In general, you should not need to run tome:export after the initial install.
  38. Any edits to config or content will be automatically synced to your output
  39. directory.
  40. There is a special Tome command, "drush tome:clean-files" that will delete any
  41. files that appear unused. This is a temporary workaround to a systemic Drupal
  42. issue with file usage and automatic deletion.
  43. When your site is looking good and ready for production, you can export static
  44. HTML. To do this, run "drush tome:static". From there you can upload your HTML
  45. files to any web hosting provider.
  46. USING SUB-MODULES
  47. =================
  48. Tome is split into two sub-modules that are automatically installed when you
  49. install Tome. Depending on your use case, you may want to install and use them
  50. separately:
  51. - Tome Static: The Tome Static sub-module handles static site (HTML)
  52. generation, and is useful if you are comfortable with your existing Drupal
  53. stack, but still want to run a static site on production.
  54. - Tome Sync: The Tome Sync sub-module handles static content export and
  55. import, and is useful if you want to build your site from scratch, or prefer
  56. to work with your content as JSON.
  57. See https://tome.fyi/docs/sub-modules/ for more details.
  58. IMPROVING TOME STATIC PERFORMANCE
  59. =================================
  60. For Tome Static users who have run into performance problems like:
  61. - Clearing all cache in the UI or with "drush cr" completely wipes Tome Static
  62. cache.
  63. - Views uses list cache tags (i.e. node_list) which means that any node save
  64. results in all Views having their cache cleared.
  65. There is a sub-module available, "Tome Static Super Cache", which changes core
  66. caching behavior to improve Tome Static performance.
  67. Enabling the sub-module will generally improve Tome Static performance, as it
  68. will start ignoring certain cache tag invalidation and prevent Tome Static
  69. cache from being wiped when rebuilding cache. To fully rebuild cache with the
  70. module enabled, you can click the "Fully clear caches" button at
  71. `/admin/config/development/performance`, or run "drush tscr".
  72. Tome Static Super Cache also provides a Views cache plugin ("Smart tag based")
  73. that does not use list cache tags, which should be used on all Views that it
  74. works on. This plugin partially executes all Views on entity create/update, and
  75. determines if that entity would show up in the View. If so, a custom View
  76. specific cache tag is cleared.
  77. RUNNING TOME STATIC ON CRON
  78. ===========================
  79. If you're running a persistent Drupal site and want to generate a static site
  80. with cron, you can enable the tome_static_cron sub-module, which queues all
  81. uncached paths when cron runs and works through them until the cache is full.
  82. To use tome_static_cron, install the module then visit
  83. /admin/config/services/tome_static_cron/settings to enter the base URL to use
  84. for static cron generations.
  85. MODIFYING TOME SYNC FILE HANDLING
  86. =================================
  87. By default, when file entities are exported, imported, or deleted, Tome Sync
  88. will keep the file export directory and your public file directory in sync by
  89. performing copies or deletes.
  90. This may not be desirable if you prefer to just symlink your files directory
  91. to a directory tracked by Git, or do not want to track files in Git at all and
  92. prefer to use persistent storage.
  93. In those cases, you can override the file handling service to use an alternate
  94. class that does nothing on file sync operations. To do this, add this block of
  95. code to your per-site services.yml file:
  96. ```
  97. services:
  98. tome_sync.file_sync:
  99. class: Drupal\tome_sync\NullFileSync
  100. ```