CI: Move pieces from screenshots.js into imgs/pieces/, don't delete
diff --git a/circle.yml b/circle.yml
index 5718fb8..13f03b1 100644
--- a/circle.yml
+++ b/circle.yml
@@ -177,22 +177,10 @@
 
     # Stitch together images
     - |-
-      for img in $(ls $CIRCLE_ARTIFACTS/imgs/); do
-        convert $CIRCLE_ARTIFACTS/imgs/$img/*.png -append $CIRCLE_ARTIFACTS/imgs/$img.png
+      for img in $(ls $CIRCLE_ARTIFACTS/imgs/pieces/); do
+        convert $CIRCLE_ARTIFACTS/imgs/pieces/$img/*.png -append $CIRCLE_ARTIFACTS/imgs/$img.png
       done
 
-    # Remove all directories in $CIRCLE_ARTIFACTS/img
-    # Currently the pieces aren't kept around. If it's
-    # desirable to keep them around, we should use
-    #    cp -r $dir $CIRCLE_ARTIFACTS/img_pieces
-    # The reason the image pieces aren't currently kept
-    # around is that it was leading to a problem. Specifically,
-    # when we get the previous images, we niavely grab any *.png,
-    # including the pieces images. This compounded so that each
-    # iteration of a test run would have all of the images from
-    # the previous test run plus whichever new images were generated.
-    - rm -R -- $CIRCLE_ARTIFACTS/imgs/*/
-
     # Download the latest mathquill artifacts from master.
     - |-
       artifacts_json="$(curl https://circleci.com/api/v1/project/mathquill/mathquill/latest/artifacts?branch=master)"
@@ -205,7 +193,8 @@
       prev_imgs="$(echo "$artifacts_json" \
                     | $json -a url pretty_path -d '\n\t' \
                     | grep '\.png$' \
-                    | grep -v 'PREV_' \
+                    | grep -v '/PREV_' \
+                    | grep -v '/pieces/' \
                     | sed "s:\$CIRCLE_ARTIFACTS/imgs/:-o $CIRCLE_ARTIFACTS/imgs/PREV_:")"
       echo 'Previous image URLs and files:'
       echo
diff --git a/script/screenshots.js b/script/screenshots.js
index 5ea2bb3..de4bd90 100644
--- a/script/screenshots.js
+++ b/script/screenshots.js
@@ -24,6 +24,7 @@
   process.exit(1);
 }
 fs.mkdirSync(baseDir+'/imgs');
+fs.mkdirSync(baseDir+'/imgs/pieces');
 
 var browsers = [
   {
@@ -101,7 +102,7 @@
       // the hard case: for Chrome, Safari, and Edge, scroll through the page and
       // take screenshots of each piece; circle.yml will stitch them together
       } else {
-        var piecesDir = baseDir + '/imgs/' + filename + '/';
+        var piecesDir = baseDir + '/imgs/pieces/' + filename + '/';
         fs.mkdirSync(piecesDir);
 
         var scrollTop = 0;