Sha256: b1dc1343da3e29232523d674f35049b57e40913081d423cef1756e9496090ffe

Contents?: true

Size: 1.42 KB

Versions: 21

Compression:

Stored size: 1.42 KB

Contents

class Converter
  module JsConversion
    def process_javascript_assets
      log_status 'Processing javascripts...'
      save_to = @save_to[:js]
      contents = {}
      read_files('js', bootstrap_js_files).each do |name, file|
        contents[name] = file
        save_file("#{save_to}/#{name}", file)
      end
      log_processed "#{bootstrap_js_files * ' '}"

      log_status 'Updating javascript manifest'
      manifest = ''
      bootstrap_js_files.each do |name|
        name = name.gsub(/\.js$/, '')
        manifest << "//= require ./bootstrap/#{name}\n"
      end
      dist_js = read_files('dist/js', %w(bootstrap.js bootstrap.min.js))
      {
          'assets/javascripts/bootstrap-sprockets.js' => manifest,
          'assets/javascripts/bootstrap.js'           => dist_js['bootstrap.js'],
          'assets/javascripts/bootstrap.min.js'       => dist_js['bootstrap.min.js'],
      }.each do |path, content|
        save_file path, content
        log_processed path
      end
    end

    def bootstrap_js_files
      @bootstrap_js_files ||= begin
        files = get_paths_by_type('js', /\.js$/).reject { |path| path =~ %r(^tests/) }
        files.sort_by { |f|
          case f
            # tooltip depends on popover and must be loaded earlier
            when /tooltip/ then
              1
            when /popover/ then
              2
            else
              0
          end
        }
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
entreprise7pro-bootstrap-sass-3.4.7 tasks/converter/js_conversion.rb
entreprise7pro-bootstrap-sass-3.4.6 tasks/converter/js_conversion.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/bootstrap-sass-3.4.1/tasks/converter/js_conversion.rb
bootstrap-sass-3.4.1 tasks/converter/js_conversion.rb
bootstrap-sass-3.4.0 tasks/converter/js_conversion.rb
bootstrap-sass-3.3.7 tasks/converter/js_conversion.rb
style-sass-1.0.0 tasks/converter/js_conversion.rb
bootstrap-sass-3.3.6 tasks/converter/js_conversion.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/bootstrap-sass-3.3.5.1/tasks/converter/js_conversion.rb
bootstrap-sass-3.3.5.1 tasks/converter/js_conversion.rb
bootstrap-sass-3.3.5 tasks/converter/js_conversion.rb