Skip to content

Commit 1000a38

Browse files
committed
initial pass on adding projectionist info to readme
1 parent 53946c8 commit 1000a38

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,44 @@ You can run any `mix` command in your project, complete with... autocomplete!
225225
- Phoenix Controllers
226226
- Phoenix Channels
227227
- Wallaby/Hound Feature tests
228+
229+
Using Projectionist you can easily generate and swap between source files and test files.
230+
231+
#### Alternate File
232+
The most basic usage is to easily swap between a source file and it's associated test.
233+
234+
While editing a **source file** such as `lib/blog_web/live/post_live.ex`, by executing the `:A` command a new buffer will be opened with the **test file** `test/blog_web/live/post_live_test.exs`.
235+
236+
#### Other Alternates
237+
While the `:A` command can easily switch between an `.ex` file and its test.
238+
There are other instances of associated files, such as [Colocated Phoenix Templates](https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.html#module-colocating-templates).
239+
In these situations you may have a source file as well as a template file.
240+
241+
While editing a **source file** such as `lib/blog_web/live/post_live.ex`, by executing the `:Eheex` command a new buffer will be opened with the **heex file** lib/blog_web/live/post_live.html.heex`.
242+
243+
If the `heex` file does not exist you will be prompted to create it, if desired.
244+
245+
Similarly, to swap back to the LiveView execute the `:Eliveview` command.
246+
247+
#### Create files
248+
In the case where a source file does not exist one can be created by supplying a directory and name to the `E` commands.
249+
250+
`:Eliveview blog_web/post_live` creates a LiveView at `lib/blog_web/live/post_live.ex` with a basic LiveView starter template defining the module.
251+
`:Econtroller blog_web/post` creates a Controller at `lib/blog_web/controllers/post.ex` with a basic Controller starter template defining the module.
252+
253+
#### Projections
254+
The ':E<filetype>' command can be run with any of the following projections in order to create/switch between files.
255+
256+
- source *(lib/\*.ex)*
257+
- controller *(lib/\*\*/controllers/\*_controller.ex)*
258+
- view *(lib/\*\*/views/\*_view.ex)*
259+
- html *(lib/\*\*/controllers/\*_html.ex)*
260+
- json *(lib/\*\*/controllers/\*_json.ex)*
261+
- component *(lib/\*\*/components/\*.ex)*
262+
- liveview *(lib/\*\*/live/\*.ex)*
263+
- livecomponent *(lib/\*\*/live/\*_component.ex)*
264+
- heex *(lib/\*\*/live/\*.html.heex)*
265+
- leex *(lib/\*\*/live/\*.html.leex)*
266+
- channel *(lib/\*\*/channels/\*_channel.ex)*
267+
- test *(test/\*\*/<projectiontype>/\*_test.exs)*
268+
- feature *(test/\*\*/features/*_test.exs)*

0 commit comments

Comments
 (0)