Sha256: 4d07816cbe322dc3a6bbe70d05ef52b52673c9918d07a1b4e7154559b8dff944

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

MIN_PATTERN = '.min'
CSS_PATTERN = '.css'

filenames_to_delete = []

# check for min styles
puts "================"
Dir.glob('stylesheets/adminlte/plugins/**/*.css') do |filename|
  basename = File.basename(filename)
  dirname = File.dirname(filename)

  # check if non min versions exists
  if basename.include? MIN_PATTERN
    max_basename = basename.gsub(MIN_PATTERN, '')
    if File.exist? File.join(dirname, max_basename)
      puts "- File has max, add to remove #{filename}"
      filenames_to_delete << filename
    end
  end
end

puts "================"
# check all non styles
Dir.glob('stylesheets/adminlte/plugins/**/*') do |filename|
  next if File.directory? filename
  basename = File.basename(filename)
  unless basename.include? CSS_PATTERN
    puts "- Non CSS file, add to remove #{filename}"
    filenames_to_delete << filename
  end
end

# delete files
puts "================"
filenames_to_delete.uniq!
puts "- Files to delete #{filenames_to_delete.size}"
n_deleted_files = File.delete *filenames_to_delete
puts "\t #{n_deleted_files} files deleted"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adminlte_assets-0.5.0 vendor/assets/script_css.rb
adminlte_assets-0.0.36 vendor/assets/script_css.rb
adminlte_assets-0.0.33 vendor/assets/script_css.rb