Skip to content

Instantly share code, notes, and snippets.

@matiaskorhonen
Last active March 2, 2019 09:11
Show Gist options
  • Save matiaskorhonen/bf403014ad25bc74a92eadeae2af1d5d to your computer and use it in GitHub Desktop.
Save matiaskorhonen/bf403014ad25bc74a92eadeae2af1d5d to your computer and use it in GitHub Desktop.
Read paths from a file and process them with https://github.com/addyosmani/critical/
<% sitemap.resources.select {|r| r.path =~ /\.html\z/i }.each do |resource| %>
<%= resource.destination_path %>
<% end %>
while IFS="" read -r html || [ -n "$html" ]
do
echo "Processing 'build/$html'"
cat "build/$html" | yarn run --silent critical --base build --folder $(dirname "build/$html") --inline | tee "build/$html" 1> /dev/null
done < build/__paths.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment