Mina: Asset precompilation when changes only occur in included gems

Created on 4 Feb 2016  ·  4Comments  ·  Source: mina-deploy/mina

It seems that mina does not detect asset changes and therefore skips precompilation when the changes have only occured in included gems (Rails engines).

So far we solve this oversight by forcing precompilation selectively with a check in deploy block

deploy do
  if hash.extras.include?("compile")
    invoke :'rails:assets_precompile:force'
  else
    invoke :'rails:assets_precompile'
  end
end

And running

mina deploy[compile]

Is there any configuration to be done to expose mina to asset changes in gems or is this a feature yet to be developed?

Most helpful comment

Just a heads up that the right env variable is: force_asset_precompile=true

All 4 comments

If I understand you right, you need to pass some settings to the deploy section.

but you always could do it in a regular way:

set :force_precompile, -> { true }

and use this setting later as you describe above, like:

deploy do
  if force_precompile
    invoke :'rails:assets_precompile:force'
  else
    invoke :'rails:assets_precompile'
  end
end

Does it makes sense?

Codewise - no. No need for the set directive, as hash.extras contains "compile".
Functionality-wise, yes. Normally we do standard mina deploy that does the "smart" precompile when asset changes are detected. Unfortunately it seems this detection does not work for assets in gems.

you can use env variables to force asset pecompilations

mina deploy force_assets=true

Just a heads up that the right env variable is: force_asset_precompile=true

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidhq picture davidhq  ·  10Comments

krishnateja picture krishnateja  ·  6Comments

thaichor picture thaichor  ·  8Comments

devvmh picture devvmh  ·  4Comments

Ilya-Kuchaev picture Ilya-Kuchaev  ·  4Comments