Appearance
Development Workflow
This guide explains the daily development workflow and best practices in LamaPress.
Table of Contents
Overview
This guide covers the typical development workflow when working with LamaPress, from starting the dev server to committing changes.
Daily Workflow
Starting Development
Start dev server:
bashnpm run devOpen site in browser:
- Visit your local site URL
- Dev server runs on Vite's default port
Enable WordPress debug:
phpdefine('WP_DEBUG', true); define('WP_DEBUG_LOG', true);
Creating Components
Create component directory:
bashmkdir -p components/sections/my_sectionCreate files:
index.php- Templateacf.php- ACF fieldsindex.js- JavaScript (optional)style.scss- Styles (optional)
Register in template:
phpllSection('my_section', 'unique_key');
Testing Changes
- Check browser console for errors
- Test responsive at different breakpoints
- Verify ACF fields in WordPress admin
- Test page transitions (if applicable)
Committing Changes
Build assets:
bashnpm run buildTest production build:
- Verify assets load correctly
- Check for console errors
Commit changes:
bashgit add . git commit -m "Add new section component"
Component Development
Creating a Section
Create directory:
bashmkdir -p components/sections/hero_customCreate
index.php:php<?php $section ??= false; $key ??= false; $title = llField('title', $key, $section); ?> <section class="ll-section ll-section--hero-custom"> <?php if ($title): ?> <h1><?= esc_html($title) ?></h1> <?php endif; ?> </section>Create
acf.php:php<?php $key = 'hero_custom_key'; $name = 'hero_custom'; $title = 'Hero Custom'; $groupFields = [ [ 'key' => 'title', 'label' => 'Title', 'name' => 'title', 'type' => 'text', ], ];Use in template:
phpllSection('hero_custom', 'page_hero');
Creating a Block
Create directory:
bashmkdir -p components/blocks/cardCreate
index.php:php<?php $title = $title ?? false; $content = $content ?? false; ?> <div class="ll-block--card"> <?php if ($title): ?> <h3><?= esc_html($title) ?></h3> <?php endif; ?> <?php if ($content): ?> <div><?= wp_kses_post($content) ?></div> <?php endif; ?> </div>Use in section:
phpllBlock('card', [ 'title' => 'Card Title', 'content' => 'Card content', ]);
Adding JavaScript
Create
index.js:javascriptimport { app } from '@src/js/core/app' export default class Card { constructor(element) { this.element = element this.init() } init = () => { this.bindEvents() } bindEvents = () => { this.element.addEventListener('click', this.handleClick) } handleClick = () => { // Handle click } destroy = () => { this.element.removeEventListener('click', this.handleClick) } }Add
data-componentto HTML:php<div class="ll-block--card" data-component="blocks/card">
Styling Workflow
Using Tailwind
Use Tailwind utilities directly in templates:
php
<div class="ll-heading-1 mb-md text-primary">
Title
</div>Custom SCSS
Add custom styles in style.scss:
scss
.ll-section--hero-custom {
.hero-content {
@apply ll-heading-1 mb-md;
}
}Best Practices
1. Start Dev Server
Always start dev server for development:
bash
npm run dev2. Test in Browser
Test changes in browser:
- Check console for errors
- Test responsive design
- Verify animations
3. Build Before Commit
Always build before committing:
bash
npm run build
git add .
git commit -m "Description"Related Documentation
- Component System - Component structure
- Build Process - Build system
- Component Guidelines - Component patterns
Next Steps:
- Review Component System for component structure
- Check Build Process for build details
- See Component Guidelines for patterns