-
Notifications
You must be signed in to change notification settings - Fork 8
Export ThemeConfig and writeDarkSwitch #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
So that it can be imported in a project that uses bootstrap-darkmode
I used to have |
@Clashsoft Thank you for the explanation. I'll try a bit find a way to make it work in both, but I don't have too high hopes knowing you tried already 🙂 |
I played around a bit today, and found that I could put |
I like the idea of export * from 'theme`; But going that route, it may be desirable to put |
I tried different values of
This would be nice, assuming there is a solution to the |
I've been playing around with
Usage in browser is then: <script src="dist/bundles/bootstrap-darkmode.umd.min.js"></script>
<script>
const BootstrapDarkmode = window['bootstrap-darkmode'];
const themeConfig = new BootstrapDarkmode.ThemeConfig();
themeConfig.initTheme();
</script> |
This change allows that
ThemeConfig
andwriteDarkSwitch
can be imported in a project that uses bootstrap-darkmode byI'm probably missing something, because from the README With NPM/Yarn/PNPM
section I don't see how the import could work. The above code snippet, is how I would expect this to work.
One further step would be to rename
theme.ts
toindex.ts
, so that the import can be just[...] from 'bootstrap-darkmode'
. But I didn't want to go that far, since I feel like I'm missing some context here.I'm not familiar with how https://unpkg.com/ works, so please make sure this change doesn't break https://unpkg.com/