Skip to content
This repository was archived by the owner on Dec 13, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion evax.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
end
end
6 changes: 5 additions & 1 deletion lib/evax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
require_relative "evax/version"
require_relative "evax/css_minifier"
require_relative "evax/logger"
require_relative "evax/railtie" if defined? Rails::Railtie

class Evax
DEFAULT_CONFIG_FILE = "config/assets.yml"
DEFAULT_RELATIVE_PATH = "public/assets"

attr_reader :config_file, :relative_path

def initialize( config_file = "config/assets.yml", relative_path = "public/assets" )
def initialize( config_file = DEFAULT_CONFIG_FILE, relative_path = DEFAULT_RELATIVE_PATH )
@config_file = File.expand_path( config_file )
@relative_path = File.expand_path( relative_path )

Expand Down
9 changes: 9 additions & 0 deletions lib/evax/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require "rails/railtie"

class Evax
class Railtie < Rails::Railtie
rake_tasks do
load "evax/tasks/evax.rake"
end
end
end
11 changes: 11 additions & 0 deletions lib/evax/tasks/evax.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace :evax do

desc "Build assets with Evax"
task :build, :config_path, :output_path do |task, args|
config_file_path = args[:config_path] || Evax::DEFAULT_CONFIG_FILE
relative_path = args[:output_path] || Evax::DEFAULT_RELATIVE_PATH

Evax.new(config_file_path, relative_path).build
end

end