Sha256: 483bcace7c8df2b08a948b4fc6a4d37541941d0db39f6908a95804664e5ffa35
Contents?: true
Size: 1.51 KB
Versions: 18
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true module CKEditor5::Rails module Cdn::Concerns module BundleBuilder def create_preset_bundle(preset) preset => { cdn:, version:, translations:, ckbox:, premium: } bundle = build_base_cdn_bundle(cdn, version, translations) bundle << build_premium_cdn_bundle(cdn, version, translations) if premium bundle << build_ckbox_cdn_bundle(ckbox) if ckbox bundle << build_plugins_cdn_bundle(preset.plugins.items) bundle end private def build_base_cdn_bundle(cdn, version, translations) Cdn::CKEditorBundle.new( Semver.new(version), 'ckeditor5', translations: translations, cdn: cdn ) end def build_premium_cdn_bundle(cdn, version, translations) Cdn::CKEditorBundle.new( Semver.new(version), 'ckeditor5-premium-features', translations: translations, cdn: cdn ) end def build_ckbox_cdn_bundle(ckbox) Cdn::CKBoxBundle.new( Semver.new(ckbox[:version]), theme: ckbox[:theme] || :lark, cdn: ckbox[:cdn] || :ckbox ) end def build_plugins_cdn_bundle(plugins) plugins.each_with_object(Assets::AssetsBundle.new(scripts: [], stylesheets: [])) do |plugin, bundle| bundle << plugin.preload_assets_bundle if plugin.preload_assets_bundle.present? end end end end end
Version data entries
18 entries across 18 versions & 2 rubygems