Class: FlexiAdmin::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/flexi_admin/railtie.rb

Instance Method Summary collapse

Instance Method Details

#absolute_gem_path(path) ⇒ Object



51
52
53
# File 'lib/flexi_admin/railtie.rb', line 51

def absolute_gem_path(path)
  [Gem::Specification.find_by_name("flexi_admin").gem_dir, path].join("/")
end

#setup_node_pathObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/flexi_admin/railtie.rb', line 55

def setup_node_path
  node_paths ||= []
  node_paths << "./node_modules"
  node_paths << absolute_gem_path("lib/flexi_admin/javascript")
  ENV["NODE_PATH"] = node_paths.join(":")

  # Set the NODE_PATH for the current bash session
  # https://nodejs.org/api/modules.html#loading-from-the-global-folders
  system("export NODE_PATH=#{ENV["NODE_PATH"]}")
end

#setup_sass_pathObject



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/flexi_admin/railtie.rb', line 66

def setup_sass_path
  sass_paths ||= []
  sass_paths << "./node_modules"
  sass_paths << absolute_gem_path("app/assets/stylesheets")
  sass_paths << absolute_gem_path("app/assets/stylesheets/components")
  ENV["SASS_PATH"] = sass_paths.join(":")

  # Set the SASS_PATH for the current bash session
  # https://sass-lang.com/documentation/cli/ruby-sass/#load-path
  system("export SASS_PATH=#{ENV["SASS_PATH"]}")
end