/ce-styles

Primary LanguageCSSGNU Lesser General Public License v2.1LGPL-2.1

About

The ce-styles repo contains the styles framework. If you're looking to manipulate the content during the baking stage, the recipes framework is contained in the cookbook repo.

Baked PDF framework guide

Styling framework tutorial

Installation

The ce-styles repo uses a docker container to simplify installation requirements. It's recommended that you either run the container in vs code, or prepend the ./script/run script before the desired command to run that command in a docker container.

To install docker, follow the instructions here.

To install enki, clone the repo from github and follow the instructions here.

Create a baked pdf for a new book

Currently, the enki platform is the recommended way to build a pdf of any given book.

To take a book completely from git repo to pdf, you'll need to run a variation of the command:

./enki --data-dir ./data/${book_name} --command all-git-pdf --repo ${book_github_repo} --book-slug ${book_slug} --style ${recipe_name} --ref main

For additional enki usage, consult enki's readme.

Run scripts

If you're in the repo's docker container (either using VScode or something else) you can just run a script like:

./script/build-styles

To build a single style: ./script/build-styles <style-name>

  • to build webview, provide generic, web, or webview-generic to <style-name> or dart styles/build/build.dart <input-file> <output-file>

Outside the container, just prepend with ./script/run:

./script/run ./script/build-styles or ./script/run dart styles/build/build.dart ...

Troubleshooting Docker builds

There is a known issue with installing dart dependencies. The connection sometimes times out on dart pub get (called within the Dockerfile). Look out for an error message reading Connection closed before full header was received. Since this is a network error/problem with how Dart manages its packages, this is outside the scope of anything we can fix. It's also not very reproducible, and seems to be pretty dependent on location/time of day/network traffic.

Workarounds:

  • Retry building the image & eventually it should build
  • Use a VPN or work from a different location (aka different IP address)
  • Comment out the line RUN dart pub get in the Dockerfile, build the image, and run dart pub get within the container to get the dependencies manually

Important Links