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

Ignore node_modules in globbing #45

Merged
merged 6 commits into from
Dec 6, 2018
Merged

Ignore node_modules in globbing #45

merged 6 commits into from
Dec 6, 2018

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented Dec 6, 2018

In the case using the custom engine or functional engine implemented in #42, Marp CLI will try globbing node_modules when specified a project directory through --input-dir or --server option.

So --server option would output ugly logs 🤮

$ marp --server ~/Documents/marp-cli
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/a11y-dark.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/a11y-light.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/agate.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/an-old-hope.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/androidstudio.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/arduino-light.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/arta.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/ascetic.css(Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/atelier-cave-dark.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/atelier-cave-light.css (Marpit theme CSS requires @theme meta.)
[  WARN ] Cannot register theme CSS: ./Documents/marp-cli/node_modules/highlight.js/styles/atelier-dune-dark.css (Marpit theme CSS requires @theme meta.)
...

This PR will ignore node_modules directory in globbing by add a pattern to ignore **/node_modules.

Example

~/Documents/marp-cli/
├── deck-a.md
├── deck-b.md
├── deck-c.md
├── node_modules
├── package-lock.json
└── package.json

Previous behavior

$ ./marp-cli.js ~/Documents/marp-cli/
[  INFO ] Converting 61 markdowns...
...

Fixed behavior

$ ./marp-cli.js ~/Documents/marp-cli/
[  INFO ] Converting 3 markdowns...
...

If you were to convert markdown files included in node_modules, you may specify node_modules directory directly.

Server

node_modules directory would be hidden from the directory index provided by --server option too.

2018-12-06 19 39 15

But it still could be accessible to http://localhost:8080/node_modules/.

@yhatt yhatt merged commit e0a31d9 into master Dec 6, 2018
@yhatt yhatt deleted the ignore-node-modules branch December 6, 2018 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant