moneyadviceservice/dough

Modernizr Build

benbarnett opened this issue · 2 comments

We have a custom modernizr build in vendor/assets/non_bower_components/modernizr which seems to be added to the asset pipeline in frontend without any additional config on either side.

It's pulled through on the frontend just by including it like this:

<%= raw Rails.application.assets['modernizr/modernizr'] %>

However we have just tried this in another app (publify) and it can't find it in the asset pipeline.

Is there any additional config we need to be able to use these sorts of components?

Hi Ben,

FYI while converting over the MAS calculators, we discovered that the script is added to the asset pipeline as long as the host application does a require 'dough' somewhere.

This will happen automatically in a normal Rails app where all dependencies are declared in the Gemfile and everything is auto-required in config/application.rb. Which is why it happens in frontend with no specific configuration.

However, there's a gotcha in Rails engines where dough may be specified in the .gemspec file: the gems declared in the .gemspec are not auto-required, so you have to explicitly require the gem yourself somewhere. I don't know why this is. It may be a weird issue in Bundler, because that's certainly not what we expected and its certainly not the first side-effect we've seen relating to Bundler and its .gemspec integration.

Hope that helps.

Dan

Hi Dan - that's exactly the sort of thing I was looking for, thanks for that! Makes a lot more sense now.