On this page
Installation
Bootstrap Barrio SASS Theme Development Guide
This guide explains how to set up and develop a custom Bootstrap Barrio SASS sub-theme for Drupal.
Table of Contents
Requirements
Before you begin, ensure you have:
- Node.js v16 installed on your server
- Drupal 8/9/10 installed
- Composer for dependency management
Installation
1. Install Base Themes
First, install the required base themes using Composer:
composer require drupal/bootstrap_barrio
composer require drupal/bootstrap_sass2. Create Sub-theme
The sub-theme creation process involves these steps:
-
Navigate to the bootstrap_sass directory:
cd web/themes/contrib/bootstrap_sass -
Make the script executable:
chmod +x scripts/create_subtheme.sh -
Run the sub-theme creation script:
./scripts/create_subtheme.sh - Follow the on-screen prompts to name your sub-theme
Your directory structure should look like this:
Drupal root (web/)
├── themes
│ ├── contrib
│ │ ├── bootstrap_barrio
│ │ └── bootstrap_sass
│ └── custom
│ └── mycustom_bootstrap_sass # Your sub-theme name3. Clean Up
After creating your sub-theme, you can remove the starter kit:
composer remove drupal/bootstrap_sassDevelopment Setup
1. Node.js Setup
Ensure you're using Node.js v16:
nvm use 162. Install Dependencies
Navigate to your sub-theme directory and install dependencies:
cd web/themes/custom/mycustom_bootstrap_sass
npm installOptional Dependencies
-
Material Design Bootstrap:
npm install mdbootstrap -
Gulp CLI (globally):
npm install --global gulp-cli
3. Configure BrowserSync
Edit your gulpfile.js to enable live reloading:
browserSync.init({
proxy: "http://yourdomain.com",
});Asset Compilation
Run Gulp to compile and watch your assets:
gulpThis will:
- Compile SASS to CSS
- Minify JavaScript
- Watch for changes
- Auto-reload the browser
Production Deployment
CSS Files
Gulp generates two CSS files:
style.css- Development version with source mapsstyle.min.css- Production version (minified)
To switch between versions, update your SUBTHEME.libraries.yml file:
css:
theme:
css/style.min.css: {} # For production
# css/style.css: {} # For developmentopmentTroubleshooting
Common Issues
- Script Permission Errors
- Solution:
chmod +x scripts/create_subtheme.sh - Alternative:
bash scripts/create_subtheme.sh
- Solution:
- Sub-theme Not Created
- Verify you're in the correct directory
- Check file permissions
- Ensure Node.js version is correct
- Gulp Not Working
- Verify Node.js version:
node -v - Check for missing dependencies:
npm install - Ensure gulp-cli is installed globally
- Verify Node.js version:
- Bootstrap Library Compatibility Warnings
A known compatibility issue exists between Bootstrap and SASS libraries, resulting in deprecation warnings during Gulp compilation.
Resolution: Install a specific SASS version to suppress these warnings:
npm install sass@1.77.6 --save-devFor detailed information, refer to Drupal issue #3471634
Getting Help
- Check the Bootstrap Barrio issue queue
- Review the Bootstrap documentation
- Join the Drupal Slack channel #bootstrap-barrio
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion