Skip to content

Commit 04b3c64

Browse files
committed
Update documentation
Introduce .env variable to toggle transcoding during setup of scrolled entry for CI/Percy
1 parent 83f5fe3 commit 04b3c64

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

entry_types/scrolled/doc/creating_content_elements.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ storiesOfContentElement(module, {
9494
```
9595

9696
The storybook depends on a static JSON file that contains seed for
97-
example files (e.g. images) that would normally be served by the
98-
Pageflow server. The easiest way to generate the seed file is to use
99-
the development setup of a working host application. Run the following
100-
command in the root directory of your host application:
97+
example files (e.g. images, audio and video files) that would normally
98+
be served by the Pageflow server. The easiest way to generate the seed
99+
file is to use the development setup of a working host application.
100+
Run the following command in the root directory of your host application
101+
(in case of audio and video files, first see
102+
[documentation below](#using-transcoded-files-in-storybook-or-percy)):
101103

102104
```bash
103105
$ bundle exec rake pageflow_scrolled:storybook:seed:setup[./seed.json]
@@ -119,6 +121,30 @@ When opening pull requests against `codevise/pageflow` the third party
119121
service [Percy](https://percy.io/) will be used to make snapshots of
120122
the stories and generate visual diffs.
121123

124+
### Using transcoded files in storybook
125+
126+
In order to use transcoded audio and video files in the local storybook,
127+
you need to specify a `ENV`-variable named `PAGEFLOW_SKIP_ENCODING_STORYBOOK_FILES`
128+
and set it to true before running the storybook seed task.
129+
This will cause background transcoding jobs for media files to be created, which
130+
will get processed upon starting the development server. Once these jobs are finished,
131+
the files are available in your local storybook via their respective
132+
`testReferenceName`.
133+
Do not set this ENV variable in CI, though. For that case a different approach is needed:
134+
135+
### Using transcoded files in Percy
136+
Since in CI there is no transcoding configured, using transcoded files in Percy requires
137+
some manual work to set up:
138+
If audio or video files should be included in CI / Percy, you need to manually
139+
copy the outputs generated for these files to the bucket specified by the
140+
"ZENCODER_OUTPUT_BUCKET" `.env` variable after transcoding.
141+
142+
Since the files are processed in sequential order and the data is created on an empty
143+
database, the ids of video and audio files always remain the same on each run of CI,
144+
i.e. the first audio file will have an id of 1, and the first video file will also have
145+
an id of 1. Remember to adjust the id part of the files directory structure accordingly
146+
upon copying manually.
147+
122148
## Editor JavaScript
123149

124150
The `editor.js` file registers the content element type with the

entry_types/scrolled/lib/tasks/pageflow_scrolled_tasks.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace :pageflow_scrolled do
9090
}
9191
},
9292
options: {
93-
skip_encoding: true
93+
skip_encoding: ENV.fetch('PAGEFLOW_SKIP_ENCODING_STORYBOOK_FILES', true)
9494
}
9595
)
9696
end

0 commit comments

Comments
 (0)