Automattic / juice

Juice inlines CSS stylesheets into your HTML source.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for juicing entire directories

yo-gi opened this issue · comments

Workaround is something like this find coverage/srcbackup -name '*.html' | xargs -P 16 -I@ yarn juice @ @
but it would be great if juice had native support for doing this as I suspect it'd be faster

Similar to #337 by @staghouse

Thanks for the hint on a workaround above @yo-gi !

My version below. This takes all *.html files in src/ and then runs juice on them to put them in build/, also with a maximum of 16 processes at once:

find src -name '*.html' | xargs basename -a | xargs -P 16 -I@ juice src/@ build/@

@karlhorky in your example do both references to src need to be the actual directory path? Or would you cd there first so it's the active directory?

Both of the src references need to point to the directory where the source files are, so if you changed into the directory with cd, then you could probably use . instead. I ran it from the root of the project, so I used src in both locations.