Sha256: 31a7543b29d174095d1f6aa33a3b84d1279ff592cbc0b944bae3496a69bc0048
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
$stdout.sync = true require "open3" require "webpacker/env" require "webpacker/configuration" namespace :webpacker do desc "Compile javascript packs using webpack for production with digests" task compile: ["webpacker:verify_install", :environment] do $stdout.puts "[Webpacker] Compiling assets 🎉" asset_host = ActionController::Base.helpers.compute_asset_host env = { "NODE_ENV" => Webpacker.env, "ASSET_HOST" => asset_host }.freeze stdout_str, stderr_str, status = Open3.capture3(env, "./bin/webpack") if status.success? $stdout.puts "\e[32m[Webpacker] Compiled digests for all packs in #{Webpacker::Configuration.entry_path}:\e[0m" $stdout.puts "\e[32m#{JSON.parse(File.read(Webpacker::Configuration.manifest_path))}\e[0m" else $stdout.puts "[Webpacker] Compilation Failed" $stdout.puts "\e[31m#{stdout_str}\e[0m" $stderr.puts "\e[31m#{stderr_str}\e[0m" exit! end end end # Compile packs after we've compiled all other assets during precompilation if Rake::Task.task_defined?("assets:precompile") Rake::Task["assets:precompile"].enhance do unless Rake::Task.task_defined?("yarn:install") # For Rails < 5.1 Rake::Task["webpacker:yarn_install"].invoke end Rake::Task["webpacker:compile"].invoke end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
webpacker-react-on-rails-3.0.0.rc.1 | lib/tasks/webpacker/compile.rake |
webpacker-react-on-rails-2.0 | lib/tasks/webpacker/compile.rake |