Skip to content

update css and js with bootstrap 5.2.1#14

Open
JuPlutonic wants to merge 3 commits intodavydovanton:masterfrom
JuPlutonic:bootstrap_5
Open

update css and js with bootstrap 5.2.1#14
JuPlutonic wants to merge 3 commits intodavydovanton:masterfrom
JuPlutonic:bootstrap_5

Conversation

@JuPlutonic
Copy link
Copy Markdown

Bootstrap 5.2.1 has officially landed!
https://blog.getbootstrap.com/2022/09/07/bootstrap-5-2-1/

@JuPlutonic
Copy link
Copy Markdown
Author

JuPlutonic commented Sep 19, 2022

[WIP] Не очень дружит со встренным в ханами-ассеты JSMin. Видимо, придётся поставить ноду и gem uglifier. По итогу, с настроенными ассетами на углифай, команда heroku assets precompile не должна выводить предупреждения. (Тестирую на фокнутом rubyjobs.dev)

[DEPENS ON] hanami-assets' ES6 support (:buildin is ES6-incompatible)
☝️Uglifier's ES6 support

Uglifier.new(harmony: true)

throws an error Skipping the asset compression "Reason: Invalid flags supplied to RegExp constructor $USER".

@JuPlutonic
Copy link
Copy Markdown
Author

I tested :buildin and :uglifier - all fail.
It's is possible to use node ~16, gems: terser and hanami-assets and MyJavascriptCompressor like in CustomTerserCompressor in code bellow (tested with https://github.com/davydovanton/rubyjobs.dev, it uses dry-container).

javascript_compressor Container[:custom_terser_compressor]

system/boot/custom_terser_compressor.rb:

# frozen_string_literal: true

require 'terser'

class CustomTerserCompressor
  def compress(source)
    terser.compile(source)
  end

  def terser
    @terser ||= begin
      require 'terser'
      Terser.new(comments: :none)
    end
  end
end

Container.boot(:custom_terser_compressor) do |container|
  init do
    container.register(:custom_terser_compressor, CustomTerserCompressor.new)
  end
end

If you don't want to use dry-container, use example from ahorek/terser-ruby#11 (comment) and

javascript_compressor CustomTerserCompressor.new

would work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants