Sha256: faed6552917e5eccd29ef9368c8438d1424e4b515e14c72529c5ba75b753bc14
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
Tailwindcss::Engine.load_tasks namespace :csspacker do desc 'Packs all CSS files from app/assets/tailwindcss_stylesheets into app/assets/application.tailwind.css then runs the tailwindcss:build' task :build do files = Dir['./app/assets/tailwindcss_stylesheets/**/*.css'] File.open('./app/assets/stylesheets/application.tailwind.css', 'w') do |main_file| main_file.write("/* GENERATED FILE! */\n") main_file.write("@tailwind base;\n") main_file.write("@tailwind components;\n") main_file.write("@tailwind utilities;\n") main_file.write("\n") files.each do |file_path| File.open(file_path, 'r') do |file| main_file.write("/* #{File.basename(file)} */\n") loop do main_file.write(file.readline) rescue StandardError main_file.write("\n") break end end end main_file end.close end desc 'Runs tailwindcss:build on changes in directory app/assets/tailwindcss_stylesheets' task :watch do listen = Listen.to(Rails.root.join('app', 'assets', 'tailwindcss_stylesheets')) do Rake::Task['csspacker:build'].execute end listen.start end end Rake::Task['tailwindcss:build'].enhance(['csspacker:build']) Rake::Task['tailwindcss:watch'].enhance(['csspacker:build']) Rake::Task['tailwindcss:watch'].enhance(['csspacker:watch'])
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tailwindcss_merger-0.2.0 | lib/tasks/csspacker.rake |