Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add webpacker caching support #1103

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/language_pack/rails4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ def public_assets_folder
"public/assets"
end

def public_webpacker_folder
"public/packs"
end

def default_assets_cache
"tmp/cache/assets"
end

def default_webpacker_cache
"tmp/cache/webpacker"
end

def cleanup
super
return if assets_compile_enabled?
Expand All @@ -81,7 +89,9 @@ def run_assets_precompile_rake_task
topic("Preparing app for Rails asset pipeline")

@cache.load_without_overwrite public_assets_folder
@cache.load_without_overwrite public_webpacker_folder
@cache.load default_assets_cache
@cache.load default_webpacker_cache

precompile.invoke(env: rake_env)

Expand All @@ -97,6 +107,9 @@ def run_assets_precompile_rake_task
cleanup_assets_cache
@cache.store public_assets_folder
@cache.store default_assets_cache

@cache.store public_webpacker_folder
@cache.store default_webpacker_cache
end
else
precompile_fail(precompile.output)
Expand All @@ -108,6 +121,7 @@ def run_assets_precompile_rake_task
def cleanup_assets_cache
instrument "rails4.cleanup_assets_cache" do
LanguagePack::Helpers::StaleFileCleaner.new(default_assets_cache).clean_over(ASSETS_CACHE_LIMIT)
LanguagePack::Helpers::StaleFileCleaner.new(default_webpacker_cache).clean_over(ASSETS_CACHE_LIMIT)
end
end
end