Peak Starter Kit
website·Indexed 33 days ago
https://peak.1902.studio/An opinionated starter kit for Statamic sites. Peak provides a set of tools and features including a modular page builder, fluid grid system, social image generation, and a dedicated Tools addon with CLI commands and a developer toolbar. It integrates with Tailwind CSS, Vite, and AlpineJS, offering built-in support for fluid typography, accessibility features like skip-to-content and reduced motion, and optimized 404 handling.
What's inside Peak
- Peak is a design-agnostic starter kit for bespoke Statamic websites. It is designed to implement SEO and accessibility (a11y) best practices. The kit is opinionated and comes pre-configured with Tailwind CSS and AlpineJS, making it compatible with various design systems.
Overview of Peak Forms functionality
Peak Forms utilize Laravel Precognition for live validation and submission. They are built following Form Design Patterns and support AlpineJS-driven conditional fields.Overview of the Peak Statamic starter kit
Peak is an opinionated starter kit designed to accelerate the development of Statamic sites. It is design-agnostic but comes pre-bundled with Tailwind CSS and AlpineJS. Key features include a built-in page builder, starter templates, fieldsets, blueprints, and SEO functionality, providing a standardized workflow that can be extended or edited to meet specific client needs.Manage global site settings in Peak
Peak provides several global configuration sets to manage site-wide settings. These include:
- Browser appearance: Configuration for browser appearance and favicons.
- Configuration: Management of the 404 entry page, copyright information, and privacy statements.
- Redirects: Setup of redirects that trigger upon 404 errors.
- SEO: Global site search engine optimization options.
- Social media: Integration of social media accounts, which are rendered as icon links in the site footer.
Prerequisites and technology stack for Peak Starter Kit
Peak is an opinionated Starter Kit built on a specific technology stack. To use Peak effectively, developers should be familiar with the following tools:
- Statamic: A flat-file CMS based on Laravel.
- Antlers: The template language used by Statamic.
- Tailwind CSS: A utility-first CSS framework.
- AlpineJS: A minimal JavaScript framework for composing behavior directly in markup.
Manage Noscript accessibility and notifications
Thenoscriptpartial ensures that content marked withx-cloakremains visible to users who have JavaScript disabled, preventing the site from appearing empty. It also displays a notification informing the user that JavaScript is required for full website functionality. The text for these notifications is translatable and can be modified inresources/lang/en/site.php.Configure binary paths for Node, npm, and Chrome
If Browsershot cannot locate the necessary binaries, or if you are running on ARM architecture (where a custom Chrome path is required), define the following variables in your.envfile. You can find the correct paths by runningwhich nodeandwhich npmin your terminal.SOCIAL_IMAGE_NODE_BINARY=/path/to/node SOCIAL_IMAGE_NPM_BINARY=/path/to/npm SOCIAL_IMAGE_CHROME_PATH=/usr/bin/chromium-browserImplement the Fluid Grid layout system
Thefluid-gridcomponent (defined inresources/css/peak.css) provides a horizontal layout spanning the full browser width. It consists of a central 12-column content area flanked by two flexible side areas (full-startandfull-end), allowing for both centered content and full-bleed elements. You can customize the grid's behavior by altering the--col-gapand--content-max-widthCSS custom properties..fluid-grid { --col-gap: clamp(1rem, 3vw, 4rem); --content-max-width: theme('screens.xl'); --padding-left: clamp(calc(env(safe-area-inset-left, 0rem) + 1rem), 2vw, calc(env(safe-area-inset-left, 0rem) + 2rem)); --padding-right: clamp(calc(env(safe-area-inset-right, 0rem) + 1rem), 2vw, calc(env(safe-area-inset-right, 0rem) + 2rem)); --col-width: calc((min(calc(100% - var(--padding-left) - var(--padding-right) - 2 * var(--col-gap)), var(--content-max-width)) - 11 * var(--col-gap)) / 12); --side-width: minmax(0, 1fr); display: grid; column-gap: var(--col-gap); grid-template-columns: [full-start] var(--side-width) [content-start col-1] var(--col-width) [col-2] var(--col-width) [col-3] var(--col-width) [col-4] var(--col-width) [col-5] var(--col-width) [col-6] var(--col-width) [col-7] var(--col-width) [col-8] var(--col-width) [col-9] var(--col-width) [col-10] var(--col-width) [col-11] var(--col-width) [col-12] var(--col-width) [content-end] var(--side-width) [full-end]; }Use the Peak Tools developer toolbar
The Peak Tools addon provides a hidden toolbar located in the bottom right corner of the screen. It becomes visible upon hovering. Key features include:
- Displays the current Tailwind CSS breakpoint (available only when the environment is set to
local). - Provides an edit button for logged-in users.
- Includes a toggle button to permanently fix the toolbar to the window.
- Displays the current Tailwind CSS breakpoint (available only when the environment is set to
Manage long-form content with the Article Bard block
For long-form content, use theArticlecontent block. This is implemented as a Statamic Bard fieldtype containing multiple sets of fields designed for use in longer articles.Style long-form content using the prose class
Apply the
proseclass to an element to ensure its children follow specific vertical flow, rhythm, and styling rules. This is particularly useful for rendering content from Bard fields. You can use the following modifiers to adjust the styling:prose-invert: Inverts the styling for dark backgrounds.prose-sm: Makes the content smaller.prose-lg: Makes the content larger.prose-xl: Makes the content even larger.
<div class="prose prose-lg"> <!-- Long form content here --> </div>Extend Peak Commands with custom content and operations
You can register custom blocks, sets, and presets for internal installation.
Custom Operations: If the built-in operations (e.g.,
copy,rename,update_page_builder) are insufficient, you can create custom operations by extending theStudio1902\PeakCommands\Operations\Operationclass and registering your own namespace.Registration Steps:
- Publish the config:
php artisan vendor:publish --tag=statamic-peak-commands-config. - Add paths to the
blocks,sets, orpresetsarrays in the config file. - Ensure each item is in its own folder with a
config.phpfile specifying thetype(snake-cased or fully qualified class name).
php artisan vendor:publish --tag=statamic-peak-commands-config- Publish the config: