Skip to content

Prefix all selectors in your plugin's or theme bootstrap CSS file because you can't avoid the conflict by using the default bootstrap CSS, because you can't know how the bootstrap CSS handle is named when being enqueued/registered in the theme or plugin.

Notifications You must be signed in to change notification settings

saiarlen/Namespace-bootstrap-to-avoid-CSS-conflicts-in-Wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

  • Download the latest bootstrap from their official Github page
  • Install node Modules in your system
  • Now open a terminal and navigate the bootstrap folder as a root
  • Run npm install to install all local dependencies
  • Install ruby
  • install Bundler with sudo gem install bundler
  • Now run bundle install
  • Now open your bootstrap folder and navigate to scss folder and open bootstrap.scss file with file editor and wrap all @import modules and prefix with your custom class

.Custom_class {
	// Configuration

	@import "functions";
	@import "variables";
	@import "mixins";
	@import "utilities";


	// Layout & components

	@import "root";
	@import "reboot";
	@import "type";
	@import "images";
	@import "grid";
	@import "tables";
	@import "forms";
	@import "buttons";
	@import "transitions";
	@import "dropdown";
	@import "button-group";
	@import "nav";
	@import "navbar";
	@import "card";
	@import "breadcrumb";
	@import "pagination";
	@import "badge";
	@import "alert";
	@import "progress";
	@import "list-group";
	@import "close";
	@import "toasts";
	@import "modal";
	@import "tooltip";
	@import "popover";
	@import "carousel";
	@import "spinners";


	// Helpers

	@import "helpers";


	// Utilities

	@import "utilities/api";
}
  • And open your minimized terminal and run npm run dist
  • Boom!!! now check your bootstrap.css file

Note: finally open your bootstap file and remove the prefixed class before html and body tags





Download boorstrsp prefixed with .alms class! if you want you can replace the class with your own class name :)

Example

<body class = ".alms">
   <div class= "row">
     <div class = "col-sm-12"> 
        <h1> enjoy </h1>
     </div>
    </div>    
</body>






source: bootstrap.com

About

Prefix all selectors in your plugin's or theme bootstrap CSS file because you can't avoid the conflict by using the default bootstrap CSS, because you can't know how the bootstrap CSS handle is named when being enqueued/registered in the theme or plugin.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published