Installation
There are two ways to get started with GhettoCDN, depending on whether you want to add it to an existing project or start fresh with a fully scaffolded application.
Existing Project
Section titled “Existing Project”Install the GhettoCDN package using your preferred package manager:
pnpm add ghettocdn --allow-build=ghettocdnnpm install ghettocdnyarn add ghettocdnbun add ghettocdnNext, create a configuration file named ghettocdn.config.yaml at the root of your project. This is where you will run all GhettoCDN commands from.
The example config below provides a sensible set of defaults to get you started:
asset_dir: assetsdist_dir: distprocessing: # Auto-scale worker threads based on CPU jobs: 0input: # Include common web + app asset types formats: - .png - .jpg - .jpeg - .webp - .gif - .svg - .json - .yaml - .yml - .woff2 - .woff - .mp4 - .webmoutput: - Images: - .webp - .jpg - .png - Animations: - .giftransform: - Animations - Images - YAML - JSONOnce your configuration is in place, create your asset directory and you’re ready to start building assets.
To learn more about the config and what each field means you can check out our configuration documentation here.
Scaffolded Project
Section titled “Scaffolded Project”To generate a new GhettoCDN project from the scaffold, use the create command of your package manager. This will load the scaffold package and ask you a few questions to customise your project.
pnpm create ghettocdn --allow-build=ghettocdnnpm create ghettocdnyarn create ghettocdnbun create ghettocdnOnce complete, your project should look like this:
Directorymy-ghettocdn-app
- ghettocdn.config.yaml GhettoCDN config file
- .gitignore
Directoryassets
- .gitkeep
- README.md
- package.json
If you chose not to install dependencies during scaffolding, you’ll need to install them before you can use GhettoCDN. If you’re using pnpm, either pass the --allow-build flag or run pnpm approve-builds after install and approve GhettoCDN.
Your GhettoCDN project is set up and ready to go. Start building assets!