Sha256: ff248d124fa250736b488b10406a14324613ababda6a4983875eb445054d6aea

Contents?: true

Size: 1.73 KB

Versions: 14

Compression:

Stored size: 1.73 KB

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/uglify.rb
# Liquid filter for J1 Template to uglify JS
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2020 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
# ------------------------------------------------------------------------------
# => Uglifier.compile(File.read(input))
# ------------------------------------------------------------------------------
#  NOTE:
#  CustomFilters cannot be used in SAFE mode (e.g not usable for
#  rendering pages with Jekyll on GitHub
#
#  USAGE:
#    {% capture cache_name %}
#
#      liquid code to generate HTML output goes here
#
#    {% endcapture %}
#    {{ cache_name | uglify }}
# ------------------------------------------------------------------------------
# noinspection SpellCheckingInspection
# rubocop:disable Lint/UnneededDisable
# rubocop:disable Style/Documentation
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/TrailingWhitespace
# rubocop:disable Layout/SpaceAroundOperators
# rubocop:disable Layout/ExtraSpacing
# rubocop:disable Metrics/AbcSize
# ------------------------------------------------------------------------------
require 'uglifier'

module Jekyll
  module MinifyJS
    def minifyJS(input)
      # see: https://github.com/mishoo/UglifyJS/issues/495
      # quote_style 3 -- always use the original quotes
      minified = Uglifier.compile(input,
                    harmony: true,
                    :output => {
                        :quote_style => 3
                    }
                 )
      input = minified
    end
  end
end

Liquid::Template.register_filter(Jekyll::MinifyJS)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
j1-template-2021.0.0 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.25 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.24 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.22 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.21 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.20 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.19 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.18 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.17 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.16 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.15 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.14 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.13 lib/starter_web/_plugins/minifyJS.rb
j1-template-2020.0.12 lib/starter_web/_plugins/minifyJS.rb