From 1fd1ed9d2360cfa8f0933af486199156fc0e09b3 Mon Sep 17 00:00:00 2001 From: Jasper van Merle Date: Sat, 20 Jul 2019 03:44:22 +0200 Subject: [PATCH] Remove public/icons from .slugignore and remove it later --- .slugignore | 3 +-- lib/tasks/assets.thor | 2 +- lib/tasks/sprites.thor | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.slugignore b/.slugignore index 6a7070f5..9daeafb9 100644 --- a/.slugignore +++ b/.slugignore @@ -1,2 +1 @@ -public/icons -test \ No newline at end of file +test diff --git a/lib/tasks/assets.thor b/lib/tasks/assets.thor index 005469e1..e9de1b6f 100644 --- a/lib/tasks/assets.thor +++ b/lib/tasks/assets.thor @@ -15,7 +15,7 @@ class AssetsCLI < Thor option :verbose, type: :boolean def compile load 'tasks/sprites.thor' - invoke 'sprites:generate', [], :verbose => options[:verbose] + invoke 'sprites:generate', [], :remove_public_icons => true, :verbose => options[:verbose] manifest.compile App.assets_compile manifest.clean(options[:keep]) if options[:clean] diff --git a/lib/tasks/sprites.thor b/lib/tasks/sprites.thor index b50f0f04..ca4e33bf 100644 --- a/lib/tasks/sprites.thor +++ b/lib/tasks/sprites.thor @@ -10,7 +10,8 @@ class SpritesCLI < Thor super end - desc 'generate [--verbose]', 'Generate the documentation icon spritesheets' + desc 'generate [--remove-public-icons] [--verbose]', 'Generate the documentation icon spritesheets' + option :remove_public_icons, type: :boolean, desc: 'Remove public/icons after generating the spritesheets' option :verbose, type: :boolean def generate items = get_items @@ -44,6 +45,11 @@ class SpritesCLI < Thor end save_manifest(items, icons_per_row, 'assets/images/sprites/docs.json') + + if options[:remove_public_icons] + logger.info('Removing public/icons') + FileUtils.rm_rf('public/icons') + end end private