Sha256: 67ae3fa7ea48b9d4e29cf7297760fb99307859c1431d1065b9ae70d013c65682

Contents?: true

Size: 651 Bytes

Versions: 19

Compression:

Stored size: 651 Bytes

Contents

# frozen_string_literal: true

module Nanoc::Filters
  # @api private
  class Terser < Nanoc::Filter
    identifier :terser
    identifier :uglify_js

    requires 'terser'

    # Runs the content through [terser](https://github.com/ahorek/terser-ruby).
    # This method optionally takes options to pass directly to Terser.
    #
    # @param [String] content The content to filter
    #
    # @option params [Array] :options ([]) A list of options to pass on to Terser
    #
    # @return [String] The filtered content
    def run(content, params = {})
      # Add filename to load path
      ::Terser.new(params).compile(content)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
nanoc-4.13.3 lib/nanoc/filters/terser.rb
nanoc-4.13.2 lib/nanoc/filters/terser.rb
nanoc-4.13.1 lib/nanoc/filters/terser.rb
nanoc-4.13.0 lib/nanoc/filters/terser.rb
nanoc-4.12.21 lib/nanoc/filters/terser.rb
nanoc-4.12.20 lib/nanoc/filters/terser.rb
nanoc-4.12.19 lib/nanoc/filters/terser.rb
nanoc-4.12.18 lib/nanoc/filters/terser.rb
nanoc-4.12.17 lib/nanoc/filters/terser.rb
nanoc-4.12.16 lib/nanoc/filters/terser.rb
nanoc-4.12.15 lib/nanoc/filters/terser.rb
nanoc-4.12.14 lib/nanoc/filters/terser.rb
nanoc-4.12.13 lib/nanoc/filters/terser.rb
nanoc-4.12.12 lib/nanoc/filters/terser.rb
nanoc-4.12.11 lib/nanoc/filters/terser.rb
nanoc-4.12.10 lib/nanoc/filters/terser.rb
nanoc-4.12.9 lib/nanoc/filters/terser.rb
nanoc-4.12.8 lib/nanoc/filters/terser.rb
nanoc-4.12.7 lib/nanoc/filters/terser.rb