LogoLogo
9.0.x
9.0.x
  • Overview
    • About Varbase
    • Roadmap
    • Release Cycle and Supported Versions
    • How to Get Support
  • Developers
    • Getting Started
    • Installing Varbase
      • Requirements
      • Installing Varbase with DDEV
      • Installing Varbase 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 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 Total Control Dashboard
        • Vartheme Claro
        • Vartheme BS4
      • Optional Components
        • Varbase API
        • Varbase Internationalization
        • Varbase Media 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
        • Varbase Style Guide
        • Reroute Email
        • Varbase Updates Helper
    • 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 Swift Mailer
        • Switch From Swift Mailer to Symfony Mailer
      • Entity Definition Update Manager Class
      • Module Installer Factory Class
    • Theme Development with Varbase
      • Understanding The Vartheme Base Theme
      • Creating Your Own Theme
      • Local Tasks and Moderation Sidebar
      • Add Preloaded Fonts in Vartheme
      • Switch From Node SASS to Dart SASS for Old Sub-Themes
    • 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
        • Switch from CKEditor 4 to CKEditor 5 in Varbase ~9.1.0
        • Updating from Varbase 8.x to 9.x
    • Varbase Patches
    • Frequently Asked Questions (FAQs)
    • Extending Varbase
      • Overriding Varbase
      • Creating Your Own Feature
      • Creating A Sub Profile From Varbase
        • Varbase Sub Profile Generator
        • Varbase Sub Profile Basic Template
        • Varbase Sub Profile Basic Project Template
      • Install Needed YARN and Gulp Tools
      • Compiling Provided Component Styles
      • Check Standards/Practice Coding And Linting
  • Content Designers
    • Terminology
    • Accessing the Administration Area
      • Website Environments
    • User Management
      • Allow Email/Username Login & Registration
      • Default Roles and Site Personas
        • Edit Roles' Permissions
        • Managing Roles
      • Add User
      • Edit User
      • Masquerading as another user
    • Dashboard
      • Reports
    • Content Structure
      • EntityQueues
      • Menu Management
        • Add Menu Items
        • Update Menu Items
        • Adding a Page to the Menu
      • Taxonomies
        • Manage Vocabulary
        • Edit Vocabulary
        • List Terms
        • Add Terms
        • Reorder and Edit Terms
      • Webforms
        • Setting up Emails Handler Conditions
        • Setting up Confirmations Message Settings Types
    • Content Management
      • Create Content
        • Add a Basic page
        • Add a Landing page
        • Add Blog
        • Add Media
          • Image
          • Remote video
          • Video
      • Modify Content
      • Delete Content
      • Preview Content
      • Bulk Edit Content
      • Content Moderation
      • Publish Content
      • URL Alias
    • About Layout Builder
      • Section
      • Custom Blocks
        • Heading Block
        • Basic Block
        • Media Block(Image/Video)
        • Rich-Text Editor “WYSIWYG”
      • Managing Blocks
    • Search Engine Optimization
      • XML Sitemap
      • Meta Tags in Varbase
      • URL Redirects
      • Domain Redirects
      • Prevent a Single Content From Being Indexed
    • Site Configuration
      • System
        • Clearing Varbase Cache
        • Google analytics
        • Mail templates
      • User interface
      • Development
      • Varbase settings
      • Web services
    • Common Error Handling Tips
  • Contributing
    • Contributing to Documentation
Powered by GitBook
On this page
  • When to Switch to Dart Sass
  • Update Npm and Nodejs to 18 Lts Version
  • Switch From Node Sass to Dart Sass Compiler
  • Re-Compile Your Scss Files to CSS Using the New Dart Sass
  • Known Issues After the Switch
  1. Developers
  2. Theme Development with Varbase

Switch From Node SASS to Dart SASS for Old Sub-Themes

PreviousAdd Preloaded Fonts in VarthemeNextLaunching a Varbase Site to Production

Last updated 1 year ago

Warning: . While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto .

  • The maintainers no longer recommend LibSass for new Sass projects. Use instead.

  • The maintainers recommend all existing LibSass users make plans to eventually move onto Dart Sass, and that all Sass libraries make plans to eventually drop support for LibSass.

  • The maintainers are no longer planning to add any new features to LibSass, including compatibility with new CSS features.

  • LibSass and Node Sass will continue to be maintained indefinitely on a best-effort basis, including fixing major bugs and security issues and maintaining compatibility with the latest Node versions.

When to Switch to Dart Sass

It is an optional direction to use the latest Dart Sass in old projects. An old project can stay using the old Node Sass package compiler. But the NPM or Yarn may face issues with old packages which are related to old not updated or no longer maintained.

Projects which had generated a new sub-theme using the and later do not need to do anything. They are using Dart Sass already.

Issue : Switched from deprecated to compiler using

Old sub-themes which had been generated from an older Vartheme BS4 version. 9.0.11 and older should follow the following steps to have the full switch:

Update Npm and Nodejs to 18 Lts Version

curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - 
sudo apt update
sudo apt install nodejs
sudo apt install build-essential

curl -L https://npmjs.com/install.sh | sudo -E bash -
sudo apt update
sudo apt install npm

Switch From Node Sass to Dart Sass Compiler

  • Change the package.json file with the following main important changes. Update local packages by running yarn install in the folder of the theme.

    ...
    ...
    "sass": "~1",
    "gulp": "~4",
    "gulp-autoprefixer": "~8",
    "gulp-clean-css": "~4",
    "gulp-concat": "~2",
    "gulp-csscomb": "~3",
    "gulp-filter": "~7",
    "gulp-html-replace": "~1",
    "gulp-postcss": "~8",
    "gulp-rename": "~2",
    "gulp-sass": "~5",
    "gulp-scss-lint": "~1",
    "gulp-sourcemaps": "~3",
    "gulp-uglify": "~3",
    ...
    ...
  • Change the gulpfile.js file from having the following required statements for the SASS object:

From sass = require("gulp-sass"),

To sass = require("gulp-sass")(require('sass')),

This includes an all-new update for coding standards and linting with the Drupal Core.

Re-Compile Your Scss Files to CSS Using the New Dart Sass

After changing all needed files

Run yarn install

and yarn theme:build or gulp compile

Check on changes after the re-compile and regression testing will be needed for sure.

Known Issues After the Switch

In case forgotten to add the @use 'sass:math';

If not the yarn theme:build or gulp compile will face issues like:

Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($hero-max-height, 2) or calc($hero-max-height / 2)

More info and automated migrator: https://sass-lang.com/d/slash-div

   ╷
79 │     $top_max_value: $hero-max-height/2;
   │                     ^^^^^^^^^^^^^^^^^^
   ╵
    scss/components/varbase-heroslider-media.component.scss 79:21  root stylesheet

Follow the latest changes from the following links for the complete list of changes that can be copied from them the :

Change the file

Change the file

Delete the file

Change the file

Change the file

Change the file

Change the file

Add the new file

Add the new file

Change the file

Add the needed from Dart Sass Add @use 'sass:math'; to the top of the file and use math.div

Custom SCSS files with old node-sass math divisions should be changed to use the module.

Issue : Switched from deprecated to compiler using and changed minimum node version to 16.0 and later in the Varbase Media Hero Slider module

LibSass and Node Sass are deprecated
Dart Sass
https://www.npmjs.com/package/node-sass
Dart Sass
Vartheme BS4 9.0.13
#3269723
Node Sass
Dart Sass
Gulp
VARTHEME BS4 SUBTHEME
package.json
gulpfile.js
.browserslistrc
.eslintrc.json
.eslintignore
.stylelintrc.json
.stylelintignore
.prettierrc.json
.prettierignore
.csscomb.json
Built-in Modules
sass:math
#3272442
Node Sass
Dart Sass
Gulp
https://www.drupal.org/project/varbase_heroslider_media/issues/3272442#comment-14472265