Sha256: affb61f34fd8b6965e5fe070766ccef882f3a19435dfa1e07e9ae6d68b0ab68c

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 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 = ''
      cat = ''
      bootstrap_js_files.each do |name|
        cat << contents[name] + "\n"
        name = name.gsub(/\.js$/, '')
        manifest << "//= require ./bootstrap/#{name}\n"
      end
      {'assets/javascripts/bootstrap-sprockets.js' => manifest,
       'assets/javascripts/bootstrap.js' => cat}.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$/
        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

5 entries across 5 versions & 2 rubygems

Version Path
bootstrap-sass-3.2.0.4 tasks/converter/js_conversion.rb
bootstrap-sass-3.3.1.0 tasks/converter/js_conversion.rb
bootstrap-sass-3.3.0.1 tasks/converter/js_conversion.rb
bootstrap-sass-3.3.0.0 tasks/converter/js_conversion.rb
bootstrap-sass-backport-3.2.0.2 tasks/converter/js_conversion.rb