Skip to content

Commit

Permalink
#34 convert application.js to coffee and application.css to sass
Browse files Browse the repository at this point in the history
  • Loading branch information
Onur Özgür ÖZKAN committed May 20, 2013
1 parent 0fcd684 commit 958bf5f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
16 changes: 9 additions & 7 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,16 @@ def setup_asset_precompile
inject_into_file 'config/application.rb', config, :after => '# config.i18n.default_locale = :de'
end

def setup_application_js
config = <<-RUBY
//= require bootstrap
RUBY

inject_into_file 'app/assets/javascripts/application.js', config, :after => '//= require turbolinks'
# Interval: Convert application.js to application.js.coffee
def convert_application_js_to_coffee
remove_file 'app/assets/javascripts/application.js'
copy_file 'app/assets/javascripts/application.js.coffee', 'app/assets/javascripts/application.js.coffee'
end

# Interval: Convert application.css to application.css.sass
def convert_application_css_to_sass
remove_file 'app/assets/stylesheets/application.css'
copy_file 'app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
end

# Internal: Leftovers
Expand Down
8 changes: 5 additions & 3 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def customization
invoke :replace_files
invoke :install_gems
invoke :gitignore_files_and_folders
invoke :setup_bootstrap
invoke :setup_bootstrap_sass_coffee
end

# Internal: Customize gemfile
Expand Down Expand Up @@ -78,10 +78,12 @@ def gitignore_files_and_folders
build :setup_gitignore_folders
end

# Internal: Setup up bootstrap
def setup_bootstrap
# Internal: Setup up bootstrap, sass, coffee
def setup_bootstrap_sass_coffee
build :setup_asset_precompile
build :setup_application_js
build :convert_application_js_to_coffee
build :convert_application_css_to_sass
end


Expand Down
17 changes: 17 additions & 0 deletions templates/app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This is a manifest file that will be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
#
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# compiled file.
#
# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
# GO AFTER THE REQUIRES BELOW.
#
#= require jquery
#= require jquery_ujs
#= require turbolinks
#= require bootstrap
#= require_tree .
12 changes: 12 additions & 0 deletions templates/app/assets/stylesheets/application.css.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* This is a manifest file that will be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .

0 comments on commit 958bf5f

Please sign in to comment.