forked from DMPRoadmap/roadmap
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cp Bootstrap & TinyMCE w/ rails assets:precompile
This commit moves the logic for copying Bootstrap glyphicons and TinyMCE skins to the public directory from the assets.rb initializer to a dedicated Rake task. The new task, `assets:copy_assets`, is invoked as part of the `assets:precompile` process. This change ensures that the file copying logic is only executed during the assets precompilation process, which prevents redundant copying of these files.
- Loading branch information
1 parent
a82d97c
commit 5f1af3d
Showing
2 changed files
with
24 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :assets do | ||
desc 'Copy Bootstrap glyphicons and TinyMCE skins to the public directory' | ||
task :copy_assets do | ||
# Bootstrap and TinyMCE expect their files to live in a specific place, so copy them over | ||
puts 'Copying Bootstrap glyphicons to the public directory ...' | ||
source_dir = Dir.glob(Rails.root.join('node_modules', 'bootstrap', 'fonts', 'glyphicons-halflings-regular.*')) | ||
destination_dir = Rails.root.join('public', 'fonts', 'bootstrap') | ||
FileUtils.mkdir_p(destination_dir) | ||
FileUtils.cp_r(source_dir, destination_dir) | ||
|
||
puts 'Copying TinyMCE skins to the public directory ...' | ||
source_dir = Dir.glob(Rails.root.join('node_modules', 'tinymce', 'skins', 'ui', 'oxide')) | ||
destination_dir = Rails.root.join('public', 'tinymce', 'skins') | ||
FileUtils.mkdir_p(destination_dir) | ||
FileUtils.cp_r(source_dir, destination_dir) | ||
end | ||
|
||
# Set assets:copy_assets as an extension of assets:precompile | ||
Rake::Task['assets:precompile'].enhance do | ||
Rake::Task['assets:copy_assets'].invoke | ||
end | ||
end |