Sha256: 71911ed908d11d622a1d0c5375478d7cdde0ef32cbb745489dface5f09e6b5dc

Contents?: true

Size: 521 Bytes

Versions: 1

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true

module Slim
  class Embedded < Filter
    class JavaScriptEngine < TagEngine
      alias orig_js_on_slim_embedded on_slim_embedded

      def on_slim_embedded(engine, body, attrs)
        minified_body = minify(body)
        orig_js_on_slim_embedded(engine, minified_body, attrs)
      end

      private

      def remove_comments!(line)
        line.last.gsub!(/((?<!['"])\/\*[^*\/]*\*\/?(?<!['"]))/, '')
        line.last.gsub!(/((?<!['"])\/\/.*[^'"]+)/, '')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slim-embedded-minify-0.2.0 lib/slim/embedded/minify/java_script_engine.rb