Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7c05de1cdd22
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: be9499fdb736
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 19, 2015

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    1a17378 View commit details
  2. Fix the check on asset engines

    Engines are classes and not instances, `<=` will check for subclasses including self.
    elia committed Mar 19, 2015

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    be9499f View commit details
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/opal/sprockets/processor.rb
9 changes: 5 additions & 4 deletions lib/opal/sprockets/processor.rb
Original file line number Diff line number Diff line change
@@ -88,9 +88,10 @@ def self.load_asset_code(sprockets, name)
asset = sprockets[name]
module_name = -> asset { asset.logical_path.sub(/\.js$/, '').inspect }

non_opal_assets = ([asset]+asset.dependencies).reject do |a|
asset_attributes = ::Sprockets::AssetAttributes.new(sprockets, a.pathname)
asset_attributes.engines.any? { |engine| engine.is_a? self }
non_opal_assets = ([asset]+asset.dependencies).select do |a|
asset_engines = ::Sprockets::AssetAttributes.new(sprockets, a.pathname).engines
processed_by_opal = asset_engines.any? { |engine| engine <= ::Opal::Processor }
not(processed_by_opal)
end

mark_as_loaded = non_opal_assets.map do |asset|
@@ -99,7 +100,7 @@ def self.load_asset_code(sprockets, name)

<<-JS
if (typeof(Opal) !== 'undefined') {
#{mark_as_loaded.join(";")};
#{mark_as_loaded.join("\n")}
Opal.load(#{module_name[asset]});
}
JS