Coder Social home page Coder Social logo

twbs / examples Goto Github PK

View Code? Open in Web Editor NEW
433.0 22.0 246.0 4.52 MB

Functional examples of using Bootstrap in common JS frameworks like Webpack, Parcel, Vite, and more!

License: MIT License

HTML 47.34% JavaScript 7.60% CSS 0.08% SCSS 29.34% Vue 6.44% TypeScript 9.19%
bootstrap bootstrap-icons parcel sass vite webpack

examples's Introduction

Bootstrap logo

Bootstrap Examples

Functional examples for building with Bootstrap using popular tools and frameworks.
Explore Bootstrap docs »

Directory

  • Starter – CDN links for our CSS and JS
  • Sass & JS — Import Sass, Autoprefixer, Stylelint, and our JS bundle via npm
  • Sass & ESM JS — Import Sass, Autoprefixer, and Stylelint via npm, and then load our ESM JS with a shim
  • Color modes – Color mode support and color mode picker built on our Sass & ESM JS example
  • Bootstrap Icons font - Import and compile Sass, Stylelint, PurgeCSS, and our icon font
  • Parcel - Sass, JS via Parcel
  • React - Sass with React Bootstrap components using React and Next.js
  • Vite - Sass, JS via Vite
  • Vue - Sass, JS via Vue/Vite
  • Webpack - Import and bundle Sass and JS with Webpack
  • PurgeCSS - import sass w/ purgecss and js via npm

License

Licensed under the MIT License.

examples's People

Contributors

dependabot[bot] avatar dherbst avatar gl0deanr avatar iamcerebrocerberus avatar julien-deramond avatar kyletsang avatar mdo avatar o-alquimista avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

Add a Vue3/Vite example

I have submitted a pull request at #5 to illustrate the issue I have encountered.

I am having trouble getting bootstrap to import into a basic Vue3/Vite app. I have studied the other examples in this repository, and cannot figure out what I am missing.

When the project builds, the following error is generated:

ENOENT: no such file or directory, stat '[base path]/vite-vue/node_modules/bootstrap/scss/bootstrap'

This is coming from the vite:css plugin, and I can find no information about how to configure that plugin correctly.

I have verified my vite.config.js has the correct ~bootstrap alias by hard-coding the path to node_modules/bootstrap/scss/bootstrap, and the same error occurs. If I reference the _bootstrap.scss file directly, another error occurs because the inline comments are unrecognized.

Any assistance would be greatly appreciated!

Setup Netlify

It might be a little trickier but if we move with #114 it should be easier

Sass compilation broken in `sass-js-esm` project

Go to sass-js-esm project and run npm i ; npm run start:

> [email protected] css
> npm-run-all css-compile css-prefix


> [email protected] css-compile
> sass --style compressed --source-map --embed-sources --no-error-css --load-path=node_modules scss/:css/

Error: Undefined variable.
    ╷
135 │     --#{$prefix}body-color: #{$body-color-dark};
    │                               ^^^^^^^^^^^^^^^^
    ╵
  bootstrap/scss/_root.scss 135:31                          @content
  node_modules/bootstrap/scss/mixins/_color-mode.scss 17:7  color-mode()
  bootstrap/scss/_root.scss 133:3                           @import
  scss/styles.scss 45:9                                     root stylesheet
ERROR: "css-compile" exited with 65.
[nodemon] app crashed - waiting for file changes before starting...

Multi-page Vite example

Prerequisites

Proposal

There is no instruction for production build with Vite JS & also how we can configure multipage bootstrap website using vite. please include a details documentation in the existing vite doc part.

Motivation and context

Using Vite with Bootstrap for product ready website is confusing because there isn't any instruction about that.

Route to stylesheet functions fails w/ Parcel

pnpm start

> [email protected] start C:\laragon\www\bootstrap-parcel
> parcel serve src/index.html --public-url / --dist-dir dist

Server running at http://localhost:1234
� Build failed.

@parcel/transformer-sass: Can't find stylesheet to import.
   ╷
34 │ @import "bootstrap/scss/functions";
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  src\scss\styles.scss 34:9  root stylesheet

  Error: Can't find stylesheet to import.
     ╷
  34 │ @import "bootstrap/scss/functions";
     │         ^^^^^^^^^^^^^^^^^^^^^^^^^^
     ╵
    src\scss\styles.scss 34:9  root stylesheet
      at Object.wrapException (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:1252:43)
      at C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:81769:25
      at _wrapJsFunctionForAsync_closure.$protected (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:4022:15)
      at _wrapJsFunctionForAsync_closure.call$2 (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:33876:12)
      at _awaitOnObject_closure.call$1 (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:33864:32)
      at Object._rootRunUnary (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:4408:18)
      at StaticClosure.<anonymous> (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:115492:16)
      at _CustomZone.runUnary$2$2 (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:35300:39)
      at _Future__propagateToListeners_handleValueCallback.call$0 (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:34363:51)
      at Object._Future__propagateToListeners (C:\laragon\www\bootstrap-parcel\node_modules\.pnpm\[email protected]\node_modules\sass\sass.dart.js:4201:93)

Floating labels not working in Parcel example

In Parcel example, Floating labels work only when I remove the following code from examples/parcel/node_modules/bootstrap/scss/forms/_floating-labels.scss

// Duplicated because `:-webkit-autofill` invalidates other selectors when grouped
> .form-control:-webkit-autofill {
  ~ label {
    opacity: $form-floating-label-opacity;
    transform: $form-floating-label-transform;
  }
}

Steps to reproduce the issue:

  1. In examples/parcel/src/scss/styles.scss, uncomment @import "bootstrap/scss/forms";
  2. Add floating labels example to examples/parcel/src/index.html
<div class="form-floating mb-3">
  <input type="email" class="form-control" id="floatingInput" placeholder="[email protected]">
  <label for="floatingInput">Email address</label>
</div>
<div class="form-floating">
  <input type="password" class="form-control" id="floatingPassword" placeholder="Password">
  <label for="floatingPassword">Password</label>
</div>
  1. npm install
  2. npm start (the label won't float when focused)
  3. Remove/Comment the above SCSS and it works

Not working on: Chrome 108.0.5359.71 (This version is outdated) on Ubuntu 16.04

Works on:
Firefox on Ubuntu 16.04 and Chrome 112 on Windows 11

Color modes data-bs-theme selector

Silly question; why does the color modes example ship with <body data-bs-theme="auto"> in index.html but in color-modes.js the setTheme is applied to document.documentElement instead of document.querySelector('body') for instance?

Enable Dependabot checks

If Dependabot is able to check sub-directories, we might want to enable Dependabot for this repository in order to be informed when there are new versions of Wepack, Parcel, Vite, etc. so that we can bump the packages versions and check if everything's still working.

Enable Dependabot for each sub-projects

Our examples are technically sub-projects that have their own dependencies in their package.json.

We should enable Dependabot for each sub-dir:

  • color-modes
  • icons-font
  • parcel
  • sass-js-esm
  • sass-js
  • starter
  • vite
  • vue
  • webpack

ATM I only update "vite" deps because I think of it thanks to the notification I receive of their new releases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.