feat(cli): inline whole directories - #669
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #337, closes #374
The CLI can now inline a whole directory:
It's detected automatically when the input is a directory (no new flag). Every
.htmland.htmfile in it, including subdirectories, is inlined and written to the same relative path in the output directory.--css,--options-file,--web-resources-*)<link>s resolve against each file's own directoryjuice src src/dist), it's skipped, so outputs never get re-inlined on the next run1at the end-(stdin/stdout) can't be combined with directoriesOne thing worth pointing out:
juiceFilefills inwebResources.relativeToon the options object it's given, only if it isn't set yet. Sharing one options object across files would make every file resolve its links against the first file's directory, so each file gets its own copy (there's a test with nested<link>s that fails without it).Performance
200 files (12KB each, remote resources off), same output:
juice src distfind src -name '*.html' | xargs -P 16 juice ...(the workaround from #374)Each separate
juiceprocess pays around half a second of Node startup + imports, so doing it in one process is ~3.6x faster, even with 16 processes in parallel on a 24-core machine.Also documented in the README's CLI section, and the
--helpargument descriptions mention directories.🤖 Generated with Claude Code