Class: Charsi::Asset
- Inherits:
-
Object
- Object
- Charsi::Asset
- Defined in:
- lib/charsi/asset.rb
Overview
Itterates each assets, processes them, and copies them to the output directory.
JavaScript and CSS files are minified.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(config) ⇒ Asset
constructor
A new instance of Asset.
Constructor Details
#initialize(config) ⇒ Asset
Returns a new instance of Asset.
6 7 8 |
# File 'lib/charsi/asset.rb', line 6 def initialize(config) @config = config end |
Instance Method Details
#build ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/charsi/asset.rb', line 10 def build assets_path = @config.path(:assets_dir, '**', '*.*') Dir.glob(assets_path).each do |asset| extension = File.extname(asset) destination_dir = @config.path(:output_dir, 'assets') destination_path = asset.sub(@config.path(:assets_dir), destination_dir) next process_javascript(asset, destination_path) if extension == '.js' next process_tailwind(asset, destination_path) if asset.include?('tailwind.css') Charsi::FileManagement.copy(asset, destination_path) end end |