Free the themes!
To run the pipeline, simply execute:
./bin/jailbreak-wordpress <WorkspaceName> <ThemeName> <ContentMapFile>
You may have to chmod +x ./bin/jailbreak-wordpress
This will perform the following actions:
- Create the directory
<WorkspaceName>/<ThemeName>
- Create a theme bundle,
<ThemeName>.json
, in that directory if it doesn't already exist. This file stores all state related to scraping and converting this theme. - Execute each stage of the pipeline, in the order found in
src/pipeline/pipeline.js
.- The theme bundle is saved automatically after each stage in the pipeline
- The pipeline aborts if a stage fails.
- The final stage in the pipeline will output a CTS-powered Mockup theme.
Run this from the project root
./bin/jailbreak-wordpress workspace TestTheme ./content-maps/testmap.json
You should get the following output:
[Theme] Initializing: TestTheme
[Pipeline] Running Stage: Fetch Pages
[Fetch Pages] Scraping index: http://blog.flickr.net/en
[Fetch Pages] Scraping post: http://blog.flickr.net/en/2013/02/14/18-year-old-prodigy-photographer/
[Pipeline] Running Stage: Fetch Assets
When it is done, you shold have the following directory structure:
./workspace
- TestTheme
- TestTheme.json
And TestTheme.json
will include the results of the pipeline run.
The theme bundle that stores all state related to the theme conversion process
is simply a JSON object called data
in the Theme object defined in
model/theme.js
. All inputs for each stage in the pipeline should be read from
this data
field and all outputs should be written to it. This ensures that
the pipeline can be stopped and restarted when we scale up.
The stages of the pipeline are:
- Fetch Pages: Download the HTML content of all pages in the Content Map.
- Fetch Assets: Walk through the DOM of each page downloaded and download any required assets (img, src, js) so that we may bundle them locally with the theme.
- Fix Assets: Rewrites the source HTML so that all linked asset URLs (img, src, js) point at a local directory structure we will create.
- Magic Occurs: todo
- Export Mockup: In
<WorkspaceName>/<ThemeName>
, create amockup
folder that in turn containsimg
,css
,cts
,js
, etc folders. Write all assets out to files in this folder.
- Node.js and NPM
- NPM Modules
- Optimist