Sha256: 27c105637414064dac9e9cf90b72ddca900de4df26beea6a8db89862340f90f3
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
# frozen_string_literal: true require "pakyow/support/extension" require "pakyow/assets/external" module Pakyow module Assets module Behavior module Externals extend Support::Extension def external_script(name, version = nil, package: nil, files: nil) assets_config = if is_a?(Plugin) parent.config.assets else config.assets end assets_config.externals.scripts << External.new( name, version: version, package: package, files: files, config: assets_config ) end apply_extension do after "boot", "fetch.assets.externals" do if config.assets.externals.pakyow external_script :pakyow, "^1.0.0-rc.1", package: "@pakyow/js", files: [ "dist/pakyow.js", "dist/components/confirmable.js", "dist/components/form.js", "dist/components/freshener.js", "dist/components/navigator.js", "dist/components/socket.js", "dist/components/submitable.js" ] end if config.assets.externals.fetch fetched = false config.assets.externals.scripts.each do |external_script| unless external_script.exist? external_script.fetch! fetched = true end end if fetched FileUtils.mkdir_p "./tmp" FileUtils.touch "./tmp/restart.txt" end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pakyow-assets-1.0.0.rc3 | lib/pakyow/assets/behavior/externals.rb |