Skip to content

config file fails to exclude glob patterns #10544

Closed

Description

@dc-p8

tailwind : 3.2.6
parcel : 2.8.3
node : v19.2.0

macOS, didn't tested other systems

Minimal bug repro : Archive.zip

Bug explanation :
Take this config file

module.exports = {
    content: [
        "./src/**/*.html",
        "!./src/**/*.pdf.html"
    ],
};

I have a file named ./src/a.pdf.html
Saving this file triggers the build process but it should be excluded as specified in the configuration file

It's not a problem with fastglob as this script :

const fg = require('fast-glob');

(async function main() {
    const entries = await fg(['./src/**/*.html', '!./src/**/*.pdf.html']);
    console.table(entries)
})()

correctly excludes my pdf.html files

Activity

  1. self-assigned this
    on Feb 9, 2023
  2. RobinMalfait commented on Feb 9, 2023

    @RobinMalfait
    Contributor

    Hey! Thank you for your bug report!
    Much appreciated! 🙏

    The minimal reproduction repo is a bit too minimal I'm afraid. Parcel is not using Tailwind CSS at this point. This is probably because your archive doesn't include the necessary dotfiles to link all the tools together.

    Adding a .postcssrc file with:

    {
      "plugins": {
        "tailwindcss": {}
      }
    }
    

    Makes things work on my end.

    That said, a lot of the tools don't have glob support directly, but rather scan a full folder. While it is true that the build will be triggered when the *.pdf.html change, those files will not be scanned by Tailwind and the use classes in there won't be included in your final css file.

    <!-- a.html -->
    <div class="bg-red-500"></div>
    <!-- a.pdf.html -->
    <div class="bg-blue-500"></div>

    Generated css:

    /* ... */
    .bg-red-500 {
      --tw-bg-opacity: 1;
      background-color: rgb(239 68 68 / var(--tw-bg-opacity));
    }

    But the bg-blue-500 is not included.

    So while the build is triggered again (out of our control) the output should be correct. If this is not the case for you, then I would ask to create a new issue with a minimal but complete reproduction that recreates the issue.

    Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions