Multi-Theme Tailwind 16 exercises

Determine How to Pass Options to a Plugin

The last thing that is hard-coded in our plugin is the way we're passing the themes.

In our multi-theme plugin we are currently importing the themes and then using it with our magic dynamic stuff.

But, as a user, you'd want to pass in your own themes when using that plugin.


Your c

Loading exercise


0:00 There's one last thing that is hard-coded in our plugin. It's the way we're passing the themes to the plugin. I'm in the plugin file. We're currently importing the themes inside this plugin. Then we're doing our magic dynamic stuff with it.

0:13 If you think about it, as a user, you'd want to use that plugin and pass your own themes object. That's exactly what we're going to do now. We're going to move the themes outside of the plugin. Then in the Tailwind config file where we call the plugin, we're going to pass the themes object as an option.

0:29 Your challenge here is to get rid of this import. That's obviously going to break everything. Instead, you want to pass the themes to the plugin here, where you register it. Have a look at the Tailwind CSS docs for a way to pass options to a plugin. Good luck.