Coder Social home page Coder Social logo

Comments (4)

webketje avatar webketje commented on June 3, 2024

This is .. intriguing.. I actually tested your suggestions (even installed emacs and followed the procedure you described at the bottom and saw the temp links appearing, node 18.12.1, MS 2.5.1) and was so far unable to reproduce (except when non-ignored or using a function ignore)

I was going to ask "are you sure this is not sth. else in your plugin chain" but that's not possible.. unless maybe if you use a plugin like debug-ui which overwrites Metalsmith methods...

Which makes me wonder, maybe the ignores somehow missed the file?
Can you check the filelist by adding a plugin like:

.use(files => console.log(Object.keys(files)))

from metalsmith.

zackw avatar zackw commented on June 3, 2024

I was using debug-ui, but I still see the problem even after commenting that out. And, in fact, I still see the problem even if I cut all of my plugins out, reducing it to the minimal example code I showed. And if I add your suggested filelist check, it doesn't get a chance to execute.

I wonder if it matters that I'm in package.json "type":"module" mode. Try that maybe? With

import Metalsmith from "metalsmith";
import * as url from "url";
const source_root = url.fileURLToPath(new URL(".", import.meta.url));
const ms = Metalsmith(source_root);
ms.source("src")
    .destination("build")
    .ignore([
      ".#*",
    ]);
await ms.build();

from metalsmith.

webketje avatar webketje commented on June 3, 2024

🤦 It's none of all we tried, and this is expected behavior.. I can't believe I looked past this. Good news is it's easy to fix (at the user's end). The description of the ignore method is

Get or set the list of filepaths or glob patterns to ignore

So evidently when ".#*" is interpreted as file path it matches none, and when it is interpreted as glob, it matches only .#filename.md at the source root. To solve your use case you need the ignore "**/.#*" (= any number of subfolders). Tested locally and working 😄

micromatch does have a basename option that allows glob patterns without slashes to match a file path based on its basename, but metalsmith.ignore is currently not configured with it/ does not provide access to its options (metalsmith.match does though)

from metalsmith.

zackw avatar zackw commented on June 3, 2024

You are correct. I assumed these worked like .gitignore patterns, i.e. "glob patterns without slashes [would] match a file path based on its basename". Adding **/ to the beginning of all the patterns fixes the problem for me.

It might be worth mentioning in the docs that these are matched using micromatch's default options.

from metalsmith.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.