Skip to content
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

Fix: Make sure toolkit includes the theme css #356

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Conversation

jackw
Copy link
Contributor

@jackw jackw commented Jun 14, 2023

Recent versions of worldmap panel have started printing out loading errors due to missing theme css. With the migration to toolkit the codebase needs to adopt the naming conventions set out by toolkit...

Theme-specific stylesheets
If you want to provide different stylesheets for dark/light theme, then create dark.[css|scss] and light.[css|scss] files in the src/styles directory of your plugin. grafana-toolkit generates theme-specific stylesheets that are stored in dist/styles directory.

In order for Grafana to pick up your theme stylesheets, you need to use loadPluginCss from @grafana/runtime package. Typically you would do that in the entry point of your plugin:

import { loadPluginCss } from '@grafana/runtime';

loadPluginCss({
dark: 'plugins//styles/dark.css',
light: 'plugins//styles/light.css',
});

@jackw jackw added the bug label Jun 14, 2023
@jackw jackw requested a review from briangann June 14, 2023 08:41
@jackw jackw self-assigned this Jun 14, 2023
@CLAassistant
Copy link

CLAassistant commented Jun 14, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@briangann briangann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll need this in other plugins, looks great!

@jackw jackw merged commit ec9e2f2 into master Jun 14, 2023
4 checks passed
@jackw jackw deleted the jackw/fix-missing-css branch June 14, 2023 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants