Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !36352

Fix StackBlitz examples by embedding snippets.js when needed

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Julien Déramond requested to merge github/fork/julien-deramond/main-jd-use-js-snippet-file-in-stackblitz into main May 14, 2022
  • Overview 14
  • Commits 12
  • Pipelines 0
  • Changes 9

Alternate version of https://github.com/twbs/bootstrap/pull/36127 Linked to tracking PR https://github.com/twbs/bootstrap/pull/36091

This PR is an alternate version of https://github.com/twbs/bootstrap/pull/36127 based on its comments. The philosophy here is to indicate when needed that a given example needs to embed the extra file snippets.js in StackBlitz:

  • by default, we create an HTML StackBlitz environment without this file
  • by setting data-js-snippet="true" we create a JS StackBlitz environment with this file

In order for the user to understand the logic here (that all the JS file content is not needed) IMO snippets.js should be heavily commented and crystal clear)

At the moment this PR only show the architecture changes. We already know that the popover example should be at the end hidden.

Extra things modified:

  • Gather other classes used in combination with .bd-example

Thoughts?

Remaining tasks

  • Add comments in snippets.js
  • Use data-js-snippet="true" everywhere in the docs when needed (see https://github.com/twbs/bootstrap/pull/36091 to have the list)

Tasks for other PRs

  • In another PR handle the edge cases for tooltips and popovers examples that won't work anyway because of the title removed by JS in the DOM. They must be hidden.
  • In another PR handle the CSS/SCSS reusable code needed by the examples.

Live previews

Alerts

  • Live example

Checks & Radios

  • Indeterminate

Modal

  • Varying modal content

Popovers

  • Live Demo: should be hidden in a next PR because title won't work as it is removed automatically by JS
  • Four directions
  • Custom popovers: popover is triggered but the custom style should be handle in another PR.
  • Dismiss on next click
  • Disabled elements

Toasts

  • Placement: toasts are moving but will need corresponding CSS in the future

Tooltips

  • Tooltips on links: should be hidden in a next PR because title won't work as it is removed automatically by JS.
  • Custom tooltips: should be hidden in a next PR because title won't work as it is removed automatically by JS.

Non-regression example (just html)

  • Accordion: snippets.js is not embedded in StackBlitz; there's no index.js created since no extra JS is needed.
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/julien-deramond/main-jd-use-js-snippet-file-in-stackblitz