Skip to main content
The assets/ directory contains all static resources required by the theme, including images, JavaScript functionality, and SCSS stylesheets. These assets are processed during build time and optimized for production.

Directory structure

src/assets/
├── images/          # Theme images and icons
├── js/              # JavaScript functionality
│   ├── partials/    # Reusable JS modules
│   └── *.js         # Page-specific scripts
└── styles/          # SCSS stylesheets
    ├── 01-settings/ # Configuration
    ├── 02-generic/  # Base styles
    ├── 03-elements/ # HTML elements
    ├── 04-components/ # Components
    └── 05-utilities/  # Utilities

Images

The images/ directory contains essential theme graphics:
images/
├── check.svg              # Checkmark icon
├── delivery-bro.svg       # Delivery illustration
├── placeholder.png        # Default image placeholder
├── s-empty.png           # Empty state (default)
├── s-empty-small.png     # Empty state (small)
├── s-empty-square.png    # Empty state (square)
└── s-empty-wide.png      # Empty state (wide)
Placeholder images are used during lazy loading and for empty states throughout the theme. Multiple aspect ratios are provided to maintain proper layout during loading.

JavaScript

Theme Raed uses vanilla JavaScript with ES6 modules for all interactive functionality.

Core JavaScript files

The central application class that initializes all theme functionality.Location: src/assets/js/app.jsKey responsibilities:
  • Mobile menu initialization using mmenu-light
  • Sticky header behavior
  • Add to cart functionality
  • Dropdown and modal management
  • Collapse component handling
  • Wishlist event listeners
  • Notification system
Dependencies:
import MobileMenu from 'mmenu-light';
import Swal from 'sweetalert2';
import Anime from './partials/anime';
import initTootTip from './partials/tooltip';
import AppHelpers from "./app-helpers";
Initialization:
class App extends AppHelpers {
  constructor() {
    super();
    window.app = this;
  }

  loadTheApp() {
    this.commonThings();
    this.initiateNotifier();
    this.initiateMobileMenu();
    // ... more initialization
  }
}
Helper methods used throughout the application.Location: src/assets/js/app-helpers.jsProvides common utility functions for:
  • DOM manipulation
  • Event handling
  • API requests
  • Data formatting
  • Common UI interactions
Base class for page-specific JavaScript functionality.Location: src/assets/js/base-page.jsProvides a foundation for page controllers to extend from.

Page-specific JavaScript

Each major page type has its own JavaScript controller:
FilePurposeLocation
home.jsHomepage interactive blockssrc/assets/js/home.js
cart.jsShopping cart functionalitysrc/assets/js/cart.js
product.jsSingle product page featuressrc/assets/js/product.js
products.jsProduct listing and filterssrc/assets/js/products.js
blog.jsBlog functionalitysrc/assets/js/blog.js
brands.jsBrand listing pagesrc/assets/js/brands.js
order.jsOrder details and trackingsrc/assets/js/order.js
wishlist.jsWishlist managementsrc/assets/js/wishlist.js
loyalty.jsLoyalty program featuressrc/assets/js/loyalty.js
testimonials.jsTestimonials displaysrc/assets/js/testimonials.js
thankyou.jsOrder confirmation pagesrc/assets/js/thankyou.js
twilight.jsTwilight mode integrationsrc/assets/js/twilight.js

JavaScript partials

Reusable modules in js/partials/:
// Animation utilities
// Handles scroll animations and transitions

Styles

Theme Raed uses SCSS with Tailwind CSS, following the ITCSS architecture for scalable and maintainable styles.

Main stylesheet

Location: src/assets/styles/app.scss The main SCSS file imports all style modules in order:
/*
 * IMPORTANT NOTE: Theme based on Tailwindcss but for the purpose of 
 * simplifying the DOM we use tailwind classes with @apply directive 
 * in the SCSS files
 */

// Settings layer
@import '01-settings/tailwind';
@import '01-settings/fonts';
@import '01-settings/global';
@import '01-settings/breakpoints';

// Generic layer
@import '02-generic/reset';
@import '02-generic/common';
@import '02-generic/animations';
// ... more imports
The theme uses Tailwind’s @apply directive to keep HTML templates clean while maintaining the utility-first approach in SCSS files.

01-settings: Configuration

Global configuration and variables:
Imports Tailwind CSS base, components, and utilities.
@tailwind base;
@tailwind components;
@tailwind utilities;
Font family definitions and custom font imports.Defines typography used throughout the theme.
Global variables for colors, spacing, and theme configuration.Contains SCSS variables that control the theme’s appearance.
Responsive breakpoint mixins for mobile-first design.Provides mixins like @include mobile, @include tablet, etc.

02-generic: Base styles

Foundation styles that apply globally:
FilePurpose
reset.scssCSS reset for consistent cross-browser styling
common.scssCommon styles and helper classes
animations.scssAnimation keyframes from anime.css library
lazyload.scssPlaceholder styles for lazy-loaded images
rtl.scssRight-to-left language adjustments
ltr.scssLeft-to-right language adjustments
tooltip.scssBase tooltip component styles
_mixins.scssReusable SCSS mixins

03-elements: HTML elements

Styling for bare HTML elements:
// buttons.scss
.btn {
  @apply px-4 py-2 rounded transition-colors;
  
  &--primary {
    @apply bg-primary text-white hover:bg-primary-dark;
  }
}
FileElements Styled
buttons.scssButton elements and variants
form.scssInput, textarea, select, label
radio.scssCustom radio button styling
radio-images.scssImage-based radio options

04-components: UI components

Component-specific styles organized by feature:
  • header.scss - Header, logo, search bar, cart icon
  • footer.scss - Footer links, newsletter, social media
  • menus.scss - Main navigation and mobile menu
  • user-menu.scss - User account dropdown
  • home-blocks.scss - All homepage block variations
  • slider.scss - Image and product sliders
  • product.scss - Single product page layout and features
  • filters.scss - Product filtering sidebar and controls
  • add-product-toast.scss - Add to cart notification
  • user-pages.scss - Profile, orders, notifications styling
  • loyalty.scss - Loyalty program UI
  • gifting.scss - Gift wrapping and messaging
  • brands.scss - Brand listing grid
  • landing-page.scss - Custom landing page builder
  • no-content-placeholder.scss - Empty state displays
  • virtooal.scss - Virtual try-on integration

05-utilities: Helpers

Utility styles and third-party integrations:
FilePurpose
swal.scssSweet Alert modal customization
chat-bots.scssChat widget positioning and styling
safari-fixes.scssSafari-specific CSS bug fixes
font-customization.scssCustom font utilities

Asset optimization

During the build process:
  1. JavaScript: Bundled, minified, and tree-shaken
  2. SCSS: Compiled to CSS, autoprefixed, minified
  3. Images: Optimized and compressed
  4. Fonts: Subset and optimized for web delivery

Using assets in templates

Assets are referenced in Twig templates using the asset() function:
{# Images #}
<img src="{{ 'images/placeholder.png' | asset }}" alt="Placeholder">

{# JavaScript #}
<script src="{{ 'app.js' | asset }}"></script>

{# Styles #}
<link rel="stylesheet" href="{{ 'app.css' | asset }}">

Next steps

Views folder

Learn about Twig templates and components

Customization

Customize styles and add functionality

Build docs developers (and LLMs) love