Skip to content

Commit

Permalink
Add spring watch directions
Browse files Browse the repository at this point in the history
Co-authored-by: Ashley Willard <ashley.willard@gusto.com>
Co-authored-by: Teal Stannard <teal.stannard@gusto.com>
Co-authored-by: Perry Hertler <perry.hertler@gusto.com>
  • Loading branch information
4 people committed Mar 8, 2024
1 parent f30bfbb commit 3eb5c65
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ If you wish to use a different directory name, eg `components` instead of `packs

If you want to have your packs code namespaced without adding a directory with the pack's name into the directory structure, you can use the [automatic namespaces gem](https://github.com/gap777/automatic_namespaces).

## Modify spring to detect pack moves

If you use spring, when you move a pack, you'll want spring to update its cache

Add this to one of your initializers
```ruby
Packs::Specification::Configuration.fetch.pack_paths.each do |dir|
Dir["#{dir}/package.yml"].each do |package_yml|
Spring.watch(package_yml)
end
end
```

### Splitting routes
`packs-rails` allows you to split your application routes for every pack. You just have to create a file describing your routes and then `draw` them in your root `config/routes.rb` file (NOTE: the `draw` function is only in Rails 6.1+).

Expand Down

0 comments on commit 3eb5c65

Please sign in to comment.