How w-nabe/animahtmlfixer works
Project Overview
• Purpose: The AnimaHTMLFixer is an open-source PHP tool designed to process HTML files exported by Anima (using Figma or Adobe XD designs) and adjust them according to specific naming conventions and configurations. It leverages the PHP “Didom” library to modify HTML markup, applying SEO tags, link changes, animation classes, and more.
• Project Type: It is a web-based PHP library/tool that simplifies turning design exports (HTML/CSS) into production-quality web pages.
• Requirements: A PHP-capable server is needed along with prearranged naming conventions in the exported design files.
Analyzing the File Structure – Main Components
• Core PHP Files (in the root): Files like _check-ua.inc, _didom_functions.inc, _operate_views.inc, and _wp_variables.inc represent key backend logic helping in processing HTML content.
• The “anima” Directory:
• Contains subdirectories such as config, css, images, include, js, and view.
• “anima/config”: Holds configuration CSVs and text snippets (for header/footer inserts) that control how HTML gets modified (site name, breakpoints, meta tags, SEO, links).
• “anima/css” & “anima/js”: Contain the styling and JavaScript files that can be modified (including responsive styles for page, dividers for different breakpoints, and custom scripts).
• “anima/include”: Contains PHP include files that perform additional tasks (like including components for embedded Google Forms, Maps, Instagram, YouTube).
• “anima/view”: This folder provides the HTML templates and CSS preview files that serve as the output structure post-transformation.
• The “vendor” Directory: This hints at managed dependencies (possibly including the Didom PHP library).
• Other Assets: Files like .htaccess and index.php handle web server configuration and the entry point for the PHP application.
Components and Relationships
a. Web Server Environment:
• PHP runtime environment that executes the core PHP files.
• .htaccess file as the entry/redirect mechanism.
b. Input (Design Export):
• Externally exported HTML/CSS files from Anima (coming via Figma or Adobe XD plugins) which are copied into the anima/view directory.
c. Processing Layer:
• PHP Scripts (including _didom_functions.inc and related inc files) that process the HTML content. This layer uses the Didom library for modifying elements based on class names and naming conventions.
• Configuration Files: Show the “anima/config” CSVs and text snippet files that feed parameters to the processing logic.
d. Output/Presentation Layer:
• Processed HTML files (located in anima/view) including specific styling (anima/css) and behavior (anima/js) along with images.
• The “include” files (like googleform.inc, googlemap.inc, etc.) that inject external or interactive elements.
e. External Systems:
• Anima (and indirectly Figma/XD): Represent the design tools that generate the export files.
• Optional external integrations such as Google Maps, YouTube, Instagram that are embedded via naming rules and include files.
Architectural Patterns and Design Principles
• Separation of Concerns: The project clearly separates configuration (CSV files, text snippets), content (HTML templates under anima/view), style (CSS in anima/css), and functionality (PHP processing components).
• Naming Conventions Driven: The entire architecture relies on consistent naming (for layers, links, animations, etc.) to automate HTML transformations.
• Modular Design: Components are split into different directories (core processing, configuration, front-end assets), which can be individually updated or extended.
• Configuration over Code: Many site settings (SEO, links, breakpoints) are centralized in config CSV files, ensuring that changes do not require in-depth code modifications.