Comments (4)
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.
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.
🤦 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.
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)
- Amplify Build Error when trying to execute metalsmith-migrated-plugins.js HOT 6
- "TypeError: gen.next is not a function" - Metalsmith 2.5.0 HOT 5
- error HOT 1
- drag and drop theme builder HOT 4
- Add Metalsmith.watch method?
- CLI - init command HOT 1
- MS files should not depend on Object prototype
- Debug not working as expected? HOT 2
- Proposal for metalsmith.get/set() helpers HOT 1
- Metalsmith 2.6 Roadmap HOT 3
- Ordinary html file not recognized as utf-8 encoded, stopping gray-matter to parse YAML HOT 3
- Launch procedure to deprecate @types/metalsmith HOT 2
- Build callback not fired with `watch()` + async plugins HOT 13
- Feature: add encoding: utf-8 property to `File` HOT 1
- Feature: provide metalsmith.on('built')
- Unhandled rejection when using callbacks (i.e. with `.watch(spec)`) HOT 2
- CLI: parse metalsmith.json as front-matter
- UnhandledPromiseRejection when plugins callback with failure HOT 8
- Remove metalsmith.concurrency?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metalsmith.