aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/css
diff options
context:
space:
mode:
authortomhuda <tomhuda@strobecorp.com>2011-05-23 23:39:04 -0700
committerwycats <wycats@gmail.com>2011-05-24 16:04:28 -0700
commit74ade51eee5a7f975f98ab2f28c77f1a10119ff5 (patch)
tree5f614130a055ec33bc4abbc3f96a452047ab4c61 /railties/lib/rails/generators/css
parent88cb89056bbdf970031a85437265c45b4007d1b6 (diff)
downloadrails-74ade51eee5a7f975f98ab2f28c77f1a10119ff5.tar.gz
rails-74ade51eee5a7f975f98ab2f28c77f1a10119ff5.tar.bz2
rails-74ade51eee5a7f975f98ab2f28c77f1a10119ff5.zip
Move SCSS generators and default templates from Rails to the Sass Railtie (d435726312601edb3ba6f97b34f562221f72c1f8).
* Sass gem registers a compressor * Sass gem registers generators for assets and scaffold * Create a default stylesheet_engine ("css") for apps that remove the Sass gem
Diffstat (limited to 'railties/lib/rails/generators/css')
-rw-r--r--railties/lib/rails/generators/css/assets/assets_generator.rb13
-rw-r--r--railties/lib/rails/generators/css/assets/templates/stylesheet.css4
-rw-r--r--railties/lib/rails/generators/css/scaffold/scaffold_generator.rb16
3 files changed, 33 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/css/assets/assets_generator.rb b/railties/lib/rails/generators/css/assets/assets_generator.rb
new file mode 100644
index 0000000000..492177ca2e
--- /dev/null
+++ b/railties/lib/rails/generators/css/assets/assets_generator.rb
@@ -0,0 +1,13 @@
+require "rails/generators/named_base"
+
+module Css
+ module Generators
+ class AssetsGenerator < Rails::Generators::NamedBase
+ source_root File.expand_path("../templates", __FILE__)
+
+ def copy_stylesheet
+ copy_file "stylesheet.css", File.join('app/assets/stylesheets', class_path, "#{file_name}.css")
+ end
+ end
+ end
+end
diff --git a/railties/lib/rails/generators/css/assets/templates/stylesheet.css b/railties/lib/rails/generators/css/assets/templates/stylesheet.css
new file mode 100644
index 0000000000..afad32db02
--- /dev/null
+++ b/railties/lib/rails/generators/css/assets/templates/stylesheet.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
diff --git a/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb
new file mode 100644
index 0000000000..1d7fe9fac0
--- /dev/null
+++ b/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb
@@ -0,0 +1,16 @@
+require "rails/generators/named_base"
+
+module Css
+ module Generators
+ class ScaffoldGenerator < Rails::Generators::NamedBase
+ # In order to allow the Sass generators to pick up the default Rails CSS and
+ # transform it, we leave it in a standard location for the CSS stylesheet
+ # generators to handle. For the simple, default case, just copy it over.
+ def copy_stylesheet
+ dir = Rails::Generators::ScaffoldGenerator.source_root
+ file = File.join(dir, "scaffold.css")
+ create_file "app/assets/stylesheets/scaffold.css", File.read(file)
+ end
+ end
+ end
+end