Method: ModJS::Blueprint#compile_application_file

Defined in:
lib/modjs-architecture.rb

#compile_application_file(file) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/modjs-architecture.rb', line 129

def compile_application_file(file)
  sprockets = Sprockets::Secretary.new(
    root: ModJS::base_dir,
    asset_root: File.expand_path(@config[:asset_root], @root),
    load_path: ['repository', @root],
    source_files: [file],
    interpolate_constants: false
  )

  application_file = sprockets.concatenation
  application_file.save_to file
  sprockets.install_assets
rescue Exception => error
  @errors = true
  puts ArchitectureJS::Notification.error "Sprockets error: #{error.message}"
end