question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move custom tailwind plugins out of tailwind.js file

See original GitHub issue

Issue

Description

We have several custom plugins inside tailwind.js file, let’s move them out from there to src/theme/plugins.

Once they are in different files we should import them and add it to tailwind.js like this:

plugins: [
    require('tailwindcss/plugins/container')({
      // center: true,
      // padding: '1rem',
    }),
   require('src/theme/plugins/panel')(),
   require('src/theme/plugins/diagonalbg')(),
   // etc...
  ],

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
klazbabacommented, Dec 26, 2018

Not programming test. I just want to see it run before making my PR. Thanks very much @tureey

0reactions
crysfelcommented, Jan 11, 2019

@klazbaba based on the error and the source code you are showing… it looks to me that the problem might be the way you are exporting inside each plugin.

Without seeing that code it’s difficult to asses, but maybe you don’t need the extra () in each require, try just this:

plugins: [
  require('./src/theme/plugins/color'),
  require('./src/theme/plugins/height'),
  // etc...
],

In order to test all you have to do is yarn start and the app should load as usual.

yarn start does everything for you (compiles css, extracts i18n files, compiles i18n files, etc…).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration - Tailwind CSS
The plugins section allows you to register plugins with Tailwind that can be used to generate extra utilities, components, base styles, or custom...
Read more >
Restructuring my tailwind.js configuration files - Oliver Davies
Currently when you run tailwind init to create a new config file, it includes all of Tailwind's default values, and then you can...
Read more >
Write A Plugin For Tailwind CSS - Egghead.io
In this tutorial, we'll build a Tailwind CSS plugin. Utility-first frameworks like Tailwind can't include every CSS style due to size concerns, ...
Read more >
How To Write A Plugin For Tailwind CSS - Nick Basile
A step-by-step walkthrough on building a Tailwind CSS plugin and uploading it to NPM.
Read more >
The complete guide to customizing a Tailwind CSS theme
The complete tutorial on creating a custom Tailwind CSS theme, ... The file tailwind.config.js is used for Tailwind CSS theme customization.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found