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

No matter what i try Tailwind is resetting my MDX styles ! #10715

Closed
7 tasks done
sadiki-o opened this issue Nov 22, 2024 · 2 comments
Closed
7 tasks done

No matter what i try Tailwind is resetting my MDX styles ! #10715

sadiki-o opened this issue Nov 22, 2024 · 2 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: invalid This issue / PR is low quality, unwanted or spam and doesn't qualify as a contribution in any way.

Comments

@sadiki-o
Copy link

sadiki-o commented Nov 22, 2024

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I have been having a headache trying to make tailwind not restart my MD default styling please help !!

Reproducible demo

No response

Steps to reproduce

here is my tailwind config:

module.exports = {
  corePlugins: {
    preflight: false, // disable Tailwind's reset
  },
  content: ["./src/**/*.{js,jsx,ts,tsx}", "./docs/*.mdx"], // my markdown stuff is in ../docs, not /src
  darkMode: ['class', '[data-theme="dark"]'], // hooks into docusaurus' dark mode settigns
  theme: {
    extend: {},
  },
  plugins: [],
}

and here is my docusaurus config:

import { themes as prismThemes } from "prism-react-renderer";
import type { Config } from "@docusaurus/types";
import type * as Preset from "@docusaurus/preset-classic";

// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)

const config: Config = {
  onBrokenLinks: "warn",
  title: "React Navigable List",
  tagline:
    "The React Navigable List is a versatile component for scrollable and non-scrollable lists, featuring keyboard navigation, drag-to-scroll, and dropdown-like selection for enhanced usability in React applications. ",
  favicon: "img/favicon.ico",

  // Set the production url of your site here
  url: "https://your-docusaurus-site.example.com",
  // Set the /<baseUrl>/ pathname under which your site is served
  // For GitHub pages deployment, it is often '/<projectName>/'
  baseUrl: "/",

  // GitHub pages deployment config.
  // If you aren't using GitHub pages, you don't need these.
  organizationName: "facebook", // Usually your GitHub org/user name.
  projectName: "docusaurus", // Usually your repo name.
  onBrokenMarkdownLinks: "warn",

  // Even if you don't use internationalization, you can use this field to set
  // useful metadata like html lang. For example, if your site is Chinese, you
  // may want to replace "en" with "zh-Hans".
  i18n: {
    defaultLocale: "en",
    locales: ["en"],
  },

  presets: [
    [
      "classic",
      {
        docs: {
          sidebarPath: "./sidebars.ts",
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            "https://github.com/sadiki-o/react-navigable-list/tree/main/packages/create-docusaurus/templates/shared/",
        },
        theme: {
          customCss: "./src/css/custom.css",
        },
      } satisfies Preset.Options,
    ],
  ],

  themeConfig: {
    // Replace with your project's social card
    image: "img/docusaurus-social-card.jpg",
    navbar: {
      title: "React Navigable List",
      // logo: {
      //   alt: "React Navigable List Logo",
      //   src: "img/logo.svg",
      // },
      items: [
        {
          type: "docSidebar",
          sidebarId: "tutorialSidebar",
          position: "left",
          label: "Docs",
        },
        {
          type: "docSidebar",
          sidebarId: "tutorialSidebar",
          position: "left",
          href: "/docs/Usage",
          label: "Examples",
        },
        {
          href: "https://github.com/sadiki-o/react-navigable-list",
          label: "GitHub",
          position: "right",
        },
      ],
    },
    footer: {
      style: "dark",
      copyright: `Copyright © ${new Date().getFullYear()} React Navigable List, MIT Licensed`,
    },
    prism: {
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
    },
  } satisfies Preset.ThemeConfig,
};

export default config;

Expected behavior

i want the md styles to remain as they are

Actual behavior

it is been overridden by tailwind resets

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.
@sadiki-o sadiki-o added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 22, 2024
@slorber
Copy link
Collaborator

slorber commented Nov 25, 2024

I'm sorry but this issue is unactionable, and looks more like a support request than an actual bug.

We need a runnable repro, and clear instructions on how to see the problem in practice. "My styles are reset" is vague and ambiguous. What CSS rule exactly is reset.


Note that Tailwind is not officially supported by Docusaurus, and you likely didn't integrate it well. Considering you don't use any plugin with configurePostCSS it's likely that your integration is wrong and it's not a bug in Docusaurus but in your code. See also this issue where various users have successfully integrated Tailwind #2961.

@slorber slorber closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
@slorber slorber added closed: invalid This issue / PR is low quality, unwanted or spam and doesn't qualify as a contribution in any way. and removed status: needs triage This issue has not been triaged by maintainers labels Nov 25, 2024
@sadiki-o
Copy link
Author

For people using MDX wondering why their md style is being changed, when you use a component that uses tailwind the directive @tailwind base is applied globally. I have searched the issue and so far there isn't an solution to that except turning off preflight and not importing @tailwind base instead use your own base styles on the classes you want to reset.
here is an example of my project https://github.com/sadiki-o/react-navigable-list.

Hope that was helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution closed: invalid This issue / PR is low quality, unwanted or spam and doesn't qualify as a contribution in any way.
Projects
None yet
Development

No branches or pull requests

2 participants