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.

Custom config isn't working

See original GitHub issue

Whenever adding a new “rule” to the config it won’t be applyed, and is so on not usable. whether as a class name nor in @apply.

this is my tailwind.config.js :

module.exports = {
  purge: [],
  theme: {
    fontFamily: {
      display: ["Roboto", "sans-serif"],
      body: ["Roboto", "sans-serif"]
    },
    colors: {
      primary: "#9cdbff"
    },
    extends: {
      margin: {
        p49: "49%",
        p32: "32%"
      }
    }
  },
  variants: {},
  plugins: []
};

my postcss.config.js :

const autoprefixer = require("autoprefixer");
const tailwindcss = require("tailwindcss");
const postcssPurgecss = require(`@fullhuman/postcss-purgecss`);

const purgecss = postcssPurgecss({
  // Specify the paths to all of the template files in your project.
  content: ["./public/**/*.html", "./src/**/*.vue"],
  // Include any special characters you're using in this regular expression.
  // See: https://tailwindcss.com/docs/controlling-file-size/#understanding-the-regex
  defaultExtractor: content => content.match(/[\w-/:]+(?<!:)/g) || [],
  // Whitelist auto generated classes for transitions and router links.
  // From: https://github.com/ky-is/vue-cli-plugin-tailwind
  whitelistPatterns: [
    /-(leave|enter|appear)(|-(to|from|active))$/,
    /^(?!(|.*?:)cursor-move).+-move$/,
    /^router-link(|-exact)-active$/
  ]
});

module.exports = {
  plugins: {
    tailwindcss,
    autoprefixer,
    ...(process.env.NODE_ENV === "production" ? [purgecss] : [])
  }
};

If I try to use a custom class in @apply e.g. my primary color it results in this error:

`@apply` cannot be used with `.bg-primary` because `.bg-primary` either cannot be found, or its actual definition includes a pseudo-selector like :hover, :active, etc. If you're sure that `.bg-primary` exists, make sure that any `@import` statements are being properly processed *before* Tailwind CSS sees your CSS, as `@apply` can only be used for classes in the same CSS tree.`

primary is shown by vs-code where i added stylelint so it seems that it detects but doesn’t apply properly.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
forsartiscommented, Aug 19, 2020

You’re welcome, I’m glad it works now.

0reactions
tomhave97commented, Aug 19, 2020

Worked fine. Issues lied in postcss.config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

custom config not executed · Issue #1326 · NvChad ... - GitHub
I tried to reinstall nvchad but didn't work. Seems like the files in the custom/ folder aren't even executed. ... Steps to reproduce...
Read more >
Custom configuration file custom_config.js not working?
I am trying to use a custom configuration file instead of the default config.js file in the ckeditor root. I have placed a...
Read more >
Custom extension config stopped working - Configuration
I have a custom stanza in my extension_custom.conf to alter the CID for incoming calls. [from-trunk-custom] exten => _X.,1,NOOP("Entered ...
Read more >
custom config not working | CKEditor.com Forums
It seems to be working fine, but I wanted to use a custom config to set up uicolor and toolbar. I can't seem...
Read more >
Custom config not working : r/tf2 - Reddit
So i wanted to have a custom config, its not an autoexec because the autoexec is replaced/used by my mastercomfig config, its a...
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