Browse Source

Remove public/icons from .slugignore and remove it later

Jasper van Merle 6 years ago
parent
commit
1fd1ed9d23
3 changed files with 9 additions and 4 deletions
  1. 1 2
      .slugignore
  2. 1 1
      lib/tasks/assets.thor
  3. 7 1
      lib/tasks/sprites.thor

+ 1 - 2
.slugignore

@@ -1,2 +1 @@
-public/icons
-test
+test

+ 1 - 1
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]

+ 7 - 1
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