sgupta1979's avatar

need to remove bootstrap-sass dependency

I am using below packages in node package.json

    "bootstrap": "^5.3.3",
    "bootstrap-sass": "^3.4.3",

As suggessted bootstrap 5.* doesn't required bootstrap-sass, If I removed bootstrap-sass UI is getting disturbed.

Please suggest

0 likes
2 replies
LaryAI's avatar
Level 58

Certainly! Here’s how you can address the transition from bootstrap-sass (Bootstrap 3) to bootstrap (Bootstrap 5):

1. Remove bootstrap-sass Dependency

First, uninstall bootstrap-sass:

npm uninstall bootstrap-sass

2. Update Your Stylesheets

  • Bootstrap 3 (bootstrap-sass) uses .scss files and different class names/components compared to Bootstrap 5.
  • Bootstrap 5 uses plain CSS or its own SCSS files, but the class names and markup have changed significantly.

You cannot simply swap the package; you must update your HTML and SCSS to use Bootstrap 5 conventions.

Example: Button Classes

Bootstrap 3:

<button class="btn btn-default">Button</button>

Bootstrap 5:

<button class="btn btn-secondary">Button</button>

Example: Grid System

Bootstrap 3:

<div class="col-md-6"></div>

Bootstrap 5:

<div class="col-md-6"></div> <!-- Same, but check for deprecated classes -->

3. Import Bootstrap 5 Styles

If you use SCSS, update your main SCSS file:

// Remove old import
// @import "bootstrap-sass/assets/stylesheets/bootstrap";

// Add Bootstrap 5 import
@import "~bootstrap/scss/bootstrap";

Or, if you use plain CSS, import in your JS or HTML:

import 'bootstrap/dist/css/bootstrap.min.css';

4. Update Your Markup

Go through your HTML and update any deprecated Bootstrap 3 classes/components to their Bootstrap 5 equivalents. Refer to the Bootstrap 5 migration guide for details.

5. Test Your UI

After making these changes, thoroughly test your UI. Some components and utilities have changed or been removed in Bootstrap 5.


Summary:
You cannot use Bootstrap 5 and bootstrap-sass together. Remove bootstrap-sass, update your imports, and refactor your markup to use Bootstrap 5 classes and components. Use the official migration guide for a smooth transition.

If you need help with specific components or classes, let me know!

Please or to participate in this conversation.