Sha256: e2a8ada45c35b4210d14ad6f21f21733570c54430f2862ea47c1309e5d06b530

Contents?: true

Size: 976 Bytes

Versions: 4

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

class Proscenium::SideLoad
  module EnsureLoaded
    def self.included(child)
      child.class_eval do
        append_after_action do
          if request.format.html? && Proscenium::Current.loaded
            if Proscenium::Current.loaded[:js].present?
              raise NotIncludedError, 'There are javascripts to be side loaded, but they have ' \
                                      'not been included. Did you forget to add the ' \
                                      '`#side_load_javascripts` helper in your views?'
            end

            if Proscenium::Current.loaded[:css].present?
              raise NotIncludedError, 'There are stylesheets to be side loaded, but they have  ' \
                                      'notbeen included. Did you forget to add the ' \
                                      '`#side_load_stylesheets` helper in your views?'
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proscenium-0.10.0-x86_64-linux lib/proscenium/side_load/ensure_loaded.rb
proscenium-0.10.0-aarch64-linux lib/proscenium/side_load/ensure_loaded.rb
proscenium-0.10.0-arm64-darwin lib/proscenium/side_load/ensure_loaded.rb
proscenium-0.10.0-x86_64-darwin lib/proscenium/side_load/ensure_loaded.rb