Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Feature Request: Don't require global bootstrap & Don't inject into global space #16

@wreiske

Description

@wreiske

Hey!

Found your package today while working on new Bootstrap 5 project. I usually use the toastr npm package but wanted something that used the bootstrap 5 toasts. Glad to see a NPM for this! Thank you for your work!

While implementing, I ran into a few little issues. I use meteor for my projects and each individual js / template / layout / etc allows you to import just what you need for that bit of code. Instead of having everything as globals, you can keep the global namespace clean and keep your includes / dynamic imports to the pages that need it only.

My first instinct was to set up a layout like this:

import Toast from 'bootstrap-toaster';

Template.hello.onRendered(function() { 
    Toast.create({ title: 'Hello world!'});
});

This didn't work because the Toast package requires bootstrap to be global. It would be nice if the above example just worked.

I managed to get it working by doing the following:

bootstrap = require('bootstrap');
import Toast from 'bootstrap-toaster';

I'd love it if bootstrap wasn't global though!!

Now the Toast is on every page and in global when it doesn't need to be.

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions