11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/generators/groundworkcss/install/install_generator.rb', line 11
def add_assets
if File.exist?('app/assets/javascripts/application.js')
insert_into_file "app/assets/javascripts/application.js", "//= require groundwork\n", :after => "jquery_ujs\n"
else
copy_file "application.js", "app/assets/javascripts/application.js"
end
if File.exist?('app/assets/stylesheets/application.css')
style_require_block = "\n@import \"groundwork-and-overrides\";\n"
insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => " */\n"
File.rename("app/assets/stylesheets/application.css", "app/assets/stylesheets/application.css.scss")
elsif File.exist?("app/assets/stylesheets/application.css.scss")
style_require_block = "\n@import \"groundwork-and-overrides\";\n"
insert_into_file "app/assets/stylesheets/application.css.scss", style_require_block, :after => " */\n"
else
copy_file "application.css.scss", "app/assets/stylesheets/application.css.scss"
end
copy_file "groundwork-and-overrides.scss", "app/assets/stylesheets/groundwork-and-overrides.scss"
end
|