LogoLogo
10.0.x
10.0.x
  • Overview
    • About Varbase
    • Roadmap
    • Release Cycle and Supported Versions
    • How to Get Support
  • Developers
    • Getting Started
    • Installing Varbase
      • Requirements
      • Installing Varbase locally with DDEV
      • Installing Varbase locally with Lando
    • Understanding Varbase
      • Basic Concepts
      • Core Components
        • Varbase Core
          • Varbase Admin
          • Varbase Page
          • Varbase Security
          • Varbase Webform
          • Varbase Default Content
          • Varbase Tour
        • Varbase Media
        • Varbase Editor
        • Varbase Email
        • Varbase SEO
        • Varbase Workflow
        • Varbase Dashboards
        • Varbase Layout Builder
          • Varbase Landing page (Layout Builder)
          • Varbase Heading Block
          • Varbase Rich Text Block
          • Varbase HTML Code Block
          • Varbase Media (Image/Video) Block
          • Varbase Gallery Block
        • Varbase Components
        • Vartheme Claro
        • Vartheme BS5
      • Optional Components
        • Varbase AI
          • Varbase AI Default recipe
          • Varbase AI Editor Assistant recipe
          • Varbase AI Image Alt recipe
          • Varbase AI Taxonomy Tagging recipe
          • Varbase AI Agents recipe
        • Varbase API
        • Varbase Internationalization
        • Varbase Hero Slider
        • Varbase Carousels
        • Varbase Blog
        • Varbase Search
        • Varbase Social Single Sign-On
        • Varbase Media Twitter
        • Varbase Media Instagram
        • Varbase Content Planner
        • Varbase Bootstrap Paragraphs
          • Varbase Bootstrap Paragraphs Text and Image
        • Varbase Landing Page (Paragraphs)
      • Additional Components
        • Varbase Media Header
        • Varbase FAQs
        • Varbase Reports
        • Varbase Commerce
        • Varbase YouTube Import
      • Development Components
        • Varbase Development
        • Reroute Email
        • Varbase Updates Helper
      • Deprecated Components
        • Varbase Media Hero Slider
        • Varbase Style Guide
        • Vartheme BS4
        • Varbase Total Control Dashboard
    • Configuring a Varbase Site
      • Navigation
        • Defining Active Menu Trail Using Menu Position
      • Using View Modes Inventory
      • Content Moderation and Workflows
      • URL Aliases in Varbase/Drupal
        • Configuring URL Aliases
        • Managing URL Aliases
      • Managing URL Patterns for Multilingual Websites
      • Managing Date and Time Formats to Display Across the Site
      • Using Varbase Layout Builder
        • Creating a Landing Page With Varbase Layout Builder
        • Activating Varbase Layout Builder for Content Types
      • Configuring Pathologic When Going Live
      • Configuring SEO Features
        • Disallow Oembed Media Links
      • Configuring Security Features
        • Spam Protection
        • Password Policies
        • Other Security Kits
        • Flood Contorl
        • Enable HTTP Password Authentication
      • Configuring JSON:API Features
      • Configure Varbase Media Hero Slider
      • Configuring Varbase Media Header
      • Configuring Varbase Mailer Settings
        • Configure Symfony Mailer
      • Configure Level of Logging and Errors
      • Entity Definition Update Manager Class
      • Module Installer Factory Class
      • Configure Ckeditor 5 Media Embed
    • Theme Development with Varbase
      • Understanding The Vartheme Starterkit Theme
      • Creating Your Own Theme
      • Integration of Varbase with Storybook 1.0 - CL Server
      • Integration of Varbase with Storybook 2.0
      • Customize a Varbase Single Directory Components (SDC) In a Custom Theme
      • Local Tasks and Moderation Sidebar
      • Add Preloaded Fonts in Vartheme
      • Command to Install Needed Theming Tools
      • Manually Install Needed Theming Tools
    • Launching a Varbase Site to Production
    • Updating a Varbase Site
      • Understanding Varbase Updater Package
      • Handling Patches When Updating
      • Handling Configuration Updates
      • Updating Varbase to work with Composer 2.0
      • Updating Drush to the Latest Stable Version
      • Version Update Guides
        • Updating Varbase ~9.0 to Drupal 10
        • Updating from Varbase 8.x to 9.x
    • Varbase Patches
    • Frequently Asked Questions (FAQs)
    • Extending Varbase
      • Overriding Varbase
      • Creating Your Own Feature
      • Install Needed YARN and Webpack Tools
      • Compiling Provided Component Styles
      • Check Standards/Practice Coding And Linting
  • Content Designers
    • Accessing the Administration Area
      • Website Environments
    • Dashboard
      • Reports
    • Content Management
      • Create Content
        • Rich-Text Editor “WYSIWYG”
      • Modify Content
      • Delete Content
      • Preview Content
      • Bulk Edit Content
      • Publish Content
      • Authoring Information
    • Content Structure
      • EntityQueues
        • Add a New Term
      • Menu Management
        • Add Menu Items
        • Update Menu Items
        • Adding a Page to the Menu
      • Taxonomies
        • List Terms
        • Add Terms
        • Reorder and Edit Terms
    • Content Translation
      • Translating Content
      • Language Switcher
      • Deleting a Translation
      • Editing a Translation
    • Content Workflow
    • Layout Builder
      • Section
        • Section Styles
      • Block Management
        • Block Styles
      • Reordering Blocks
    • Webforms
      • Create New Webform View
      • Setting up Emails Handler Conditions
      • Setting up Confirmations Message Settings Types
    • Media Management
      • Accessing the Media Library
      • Uploading Media Files
        • Image
        • Remote Video
        • Video
      • Applying Metadata and Descriptions
      • Resizing Images
    • User Management
      • Login & Registration
      • Add User
      • Edit User
      • Delete User
      • Simulating Another User
      • Default Roles and Site Personas
        • Edit Roles' Permissions
        • Managing Roles
    • URL Management
      • URL Aliases
      • Generating URL Alias
      • URL Redirects
      • Domain Redirects
    • SEO Management
      • XML Sitemap
      • Meta Tags in Varbase
      • Disallow Indexing for Content Items
    • Site Configuration
      • System
        • Clearing Varbase Cache
        • Google Analytics
        • Mail Templates
      • User Interface
        • Coffee
        • External Links
        • Gin Moderation Sidebar
        • Layout Builder Modal
        • Moderation Sidebar
        • Shortcuts
        • Taxonomy Manager
        • Tours
        • CL Components
        • Antibot
        • Responsive Preview
        • Navigation Settings
      • Development
      • Varbase Settings
      • Web Services
        • OpenAPI
    • Additional Tips
      • Content Uploading Standards
      • Common Error Handling Tips
      • Glossary
  • Contributing
    • Contributing to Documentation
Powered by GitBook
On this page
  • Install Needed Tools Command
  • Install Needed Tools Manually
  • Create new Vartheme BS5 Cloned Generated Theme
  • How to use the Vartheme BS5 Starterkit
  • Copy All Varbase Components to the New Custom Theme
  • Customizing CSS
  • Customizing Bootstrap's JavaScripts
  • Install the Dependencies for Needed Packages
  • Initialize the Theme Once
  • Compile Once
  • Compile all
  • Compile SDC Components Only
  • Compile Custom Theme Styling Only
  • Watching and Syncing
  • Reporting Starterkit Bugs
  • Additional Information
  • Cloning a Project
  1. Developers
  2. Theme Development with Varbase

Creating Your Own Theme

PreviousUnderstanding The Vartheme Starterkit ThemeNextIntegration of Varbase with Storybook 1.0 - CL Server

Last updated 9 months ago

After building and installing the project with the template, use the using the Vartheme starterkit command.

Before that have a look at:

Learn more about Bootstrap standard build tools documentation, compile source code, run tests, and more.

Install Needed Tools Command

Utilize the command provided in the following link to automatically configure all necessary Node.js or theme processing requirements:

Install Needed Tools Manually

Please refer to the following link for a comprehensive set of instructions or an external resource to guide you through the setup process:

Create new Vartheme BS5 Cloned Generated Theme

How to use the Vartheme BS5 Starterkit

To generate a new theme from Vartheme BS5 using the starterkit/theme-generation script, run the following from Drupal's installation root:

cd PROJECT_DIR_NAME/docroot

Run the following Drupal Generate Theme script:

php core/scripts/drupal generate-theme new_theme_name --starterkit vartheme_bs5 --path themes/custom

Additionally, you can create the theme's human-readable name and it description with two optional arguments:

php core/scripts/drupal generate-theme new_theme_name \
  --starterkit vartheme_bs5 \
  --path themes/custom \
  --name "New Theme Name" \
  --description "Custom theme generated from Vartheme BS5 theme" 

This script will copy over all the files from the Vartheme BS5 theme, and replace instances of Vartheme BS5's machine name and label with the strings you provide.

After Installing the New Custom Theme

Uninstall Vartheme BS5 after creating a new theme

At this point the new generated theme will not need the Vartheme BS5 to be installed.

Copy All Varbase Components to the New Custom Theme

cd PATH_TO_THE_PROJECT/docroot
cp -r modules/contrib/varbase_components/components themes/custom/PROJECT_THEME/components

Add replaces: to all copied Varbase Components within all .component.yml files.

Follow up with the following link

Customizing CSS

The new theme should look and function identically to Vartheme BS5 out of the box, but the styles could be changed to suit the project's needs. Vartheme BS5's styles are written using Bootstrap 5, SASS, PostCSS, which is installed and configured Varbase, and allows CSS authors to write modern CSS while still supporting browsers that have not fully implemented the newest methodologies.

Customizing Bootstrap's JavaScripts

As part of the generate-theme command, the necessary package.json dependencies and scripts files are copied over for the project. Simply install the dependencies and then run yarn theme:init once, and then either the yarn theme:full-build command to compile the assets once or the yarn theme:watch command to re-compile the assets every time a .scss file is changed.

Install the Dependencies for Needed Packages

yarn install

Recommended to use Yarn, Please do not use npm install

you may run into issue while installing

the list of packages in the package.json was optimized for better use with Yarn

Initialize the Theme Once

yarn theme:init

Ensure that you perform this step immediately after generating and installing packages, or after updating Bootstrap, Font Awesome, or any other necessary extensions.

Additionally, any additional external libraries from the node_modules folder can be managed by copying them to a designated target libraries folder.

It is essential to include comprehensive "install once" or "configure once" options that can be utilized by new development team members when they join the project for custom theme development or theming. This approach ensures a smooth onboarding process and facilitates seamless setup for new team members.

Compile Once

With webpack, project can compile may type of files and integrate with more nodejs processing tools.

Compile all

Use the following alias script command to compile all SCSS, JS, or SVG icons.

yarn theme:full-build

Compile SDC Components Only

In case of working on a custom SDC component, an alias script command can help with the.

yarn components:build

Have a look at the following link for more info:

Compile Custom Theme Styling Only

In case of working on small custom theme styling, which no need to compile components. The following alias script command can help compile in a quick way.

yarn theme:build

Watching and Syncing

Use to only while working to auto compile custom theme styling

yarn theme:watch

theme:watch is targeted for the theme only, but it can be customized in custom theme

Reporting Starterkit Bugs

Additional Information

Starterkit is for generating new themes that include reasonably un-opinionated templates and styles that eliminate much of the the initial work required to create a theme.

Cloning a Project

On the state of working in a team in a project, the created theme could be don by other member of the team.

When the theme get committed by git for example, the node_modules folder will not be committed. As it is listed in the .gitignore file.

After cloning a project with a Vartheme cloned generated theme.

Run the following commands to get all development tools

cd PROJECT_DIR_NAME/docroot/themes/custom/THEME_NAME
yarn install
yarn theme:init
yarn theme:full-build

Issue : Moved all Bootstrap ~5.3.0 JavaScript libraries to Single Directory Components (SDC) in Varbase Components

Issue : Added Bootstrap ~5.3.0 JavaScript libraries in Varbase Components and only attache them with needed SDC components

The theme:init script alias will trigger the execution of webpack --progress --config webpack.config.init.js. This command is responsible for copying the specified files and folders from the configuration file to their respective locations.

The components:build script alias will trigger the execution of webpack --progress --config webpack.config.components.js. This command is responsible only for compiling custom SDC components in the them. The file has the list of entry, and output for compiled css/js/svg script to the right public path.

Should you encounter a bug while generating a new theme, please

Starterkit is the recommended approach for creating new themes. For more information, consult the .

Varbase Project
Drupal Generate Theme
Understanding The Vartheme Starterkit Theme
https://getbootstrap.com/docs/5.3/getting-started/contribute/#tooling-setup
Command to Install Needed Theming Tools
Manually Install Needed Theming Tools
Customize a Varbase Single Directory Components (SDC) In a Custom Theme
#3423178
#3423174
Install Needed YARN and Webpack Tools
webpack.config.init.js
webpack.config.components.js
Customize a Varbase Single Directory Components (SDC) In a Custom Theme
create a new issue
Starterkit documentation on Drupal.org