Class: PagesCore::Generators::FrontendGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/rails/generators/pages_core/frontend/frontend_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_css_frameworkObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rails/generators/pages_core/frontend/frontend_generator.rb', line 16

def create_css_framework
  ["application.sass.scss",
   "config.scss",
   "components/base.scss",
   "framework/breakpoints.scss",
   "framework/clearfix.scss",
   "framework/grid.scss",
   "framework/grid_overlay.scss",
   "framework/fonts.scss",
   "global/colors.scss",
   "global/typography.scss",
   "vendor/normalize.css"].each do |f|
    template("stylesheets/#{f}", File.join("app/assets/stylesheets/#{f}"))
  end
end

#create_js_frameworkObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rails/generators/pages_core/frontend/frontend_generator.rb', line 32

def create_js_framework
  ["lib/ResponsiveEmbeds.js",
   "lib/GridOverlay.js"].each do |f|
    template("javascript/#{f}", File.join("app/javascript/#{f}"))
  end

  append_to_file "app/javascript/application.js" do
    <<~JS
      // Responsive embeds
      import ResponsiveEmbeds from "./lib/ResponsiveEmbeds";
      ResponsiveEmbeds.start();

      // Grid overlay
      import GridOverlay from "./lib/GridOverlay";
      GridOverlay.start();
    JS
  end
end

#create_layoutObject



9
10
11
12
13
14
# File 'lib/rails/generators/pages_core/frontend/frontend_generator.rb', line 9

def create_layout
  copy_file(
    "application.html.erb",
    File.join("app/views/layouts/application.html.erb")
  )
end

#remove_application_cssObject



51
52
53
# File 'lib/rails/generators/pages_core/frontend/frontend_generator.rb', line 51

def remove_application_css
  remove_file("app/assets/stylesheets/application.css")
end