module Roda::RodaPlugins::Assets::ClassMethods

  1. lib/roda/plugins/assets.rb

Methods

Public Instance

  1. compile_assets

Public Instance methods

compile_assets(type=nil)

Compile options for the given asset type. If no asset_type is given, compile both the :css and :js asset types. You can specify an array of types (e.g. [:css, :frontend]) to compile assets for the given asset group.

[show source]
    # File lib/roda/plugins/assets.rb
521 def compile_assets(type=nil)
522   require 'fileutils'
523 
524   _update_compiled_assets(_compiled_assets_initial_hash) unless assets_config.compiled
525 
526   if type == nil
527     _compile_assets(:css)
528     _compile_assets(:js)
529   else
530     _compile_assets(type)
531   end
532 
533   if precompile_file = assets_config.precompiled
534     ::FileUtils.mkdir_p(File.dirname(precompile_file))
535     tmp_file = "#{precompile_file}.tmp"
536     ::File.open(tmp_file, 'wb'){|f| f.write(json_serializer.call(assets_config.compiled))}
537     ::File.rename(tmp_file, precompile_file)
538   end
539 
540   assets_config.compiled
541 end