discourse/lib/tasks/svg_icons.rake
Penar Musaraj 005e1ecb9b
FEATURE: Update Font Awesome to v5.4.1 and SVGs (#6557)
* First take on subsetting svg icons

* FontAwesome 5 svg subset WIP

* Include icons from plugins/badges into svg sprite subset

* add svg icon support to themes

* Add spec for SvgSprite

* Misc. SVG icon fixes

* Use FA5 svgs in local-dates plugin

* CSS adjustments, fix SVG icons in group flair

* Use SVG icons in poll plugin

* Add SVG icons to /wizard
2018-11-07 13:05:43 -05:00

39 lines
729 B
Ruby

def vendor_svgs
"#{Rails.root}/vendor/assets/svg-icons"
end
def library_src
"#{Rails.root}/node_modules"
end
task 'svgicons:update' do
yarn = system("yarn install")
abort('Unable to run "yarn install"') unless yarn
dependencies = [
{
source: '@fortawesome/fontawesome-free/sprites',
destination: 'fontawesome',
}
]
start = Time.now
dependencies.each do |f|
src = "#{library_src}/#{f[:source]}"
unless f[:destination]
filename = f[:source].split("/").last
else
filename = f[:destination]
end
dest = "#{vendor_svgs}/#{filename}"
FileUtils.cp_r(src, dest)
end
STDERR.puts "Completed copying dependencies: #{(Time.now - start).round(2)} secs"
end