Skip to content

Commit fdcf65f

Browse files
Jorge Bejar and Ronit Katzchriseppstein
authored andcommitted
Add suport to generate scss files in rails engines
1 parent 74c5e4e commit fdcf65f

File tree

49 files changed

+528
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+528
-1
lines changed

lib/sass/rails/railtie.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ module SassContext
2222
# Send Sass logs to Rails.logger
2323
config.sass.logger = Sass::Rails::Logger.new
2424

25+
# Set the default stylesheet engine
26+
# It could be overrided by application specific settings:
27+
# config.sass.preferred_syntax = :sass
28+
# or by passing:
29+
# --stylesheet_engine=sass in the rails new/generate commands
30+
config.app_generators.stylesheet_engine config.sass.preferred_syntax
31+
2532
config.before_initialize do |app|
2633
unless app.config.assets && app.config.assets.enabled
2734
raise "The sass-rails plugin requires the asset pipeline to be enabled."
@@ -39,7 +46,7 @@ module SassContext
3946
alt_syntax = syntax == :sass ? "scss" : "sass"
4047
app.config.generators.hide_namespace alt_syntax
4148

42-
# Set the stylesheet engine to the preferred syntax
49+
# Override stylesheet engine to the preferred syntax
4350
config.app_generators.stylesheet_engine syntax
4451

4552
# Set the sass cache location to tmp/sass-cache
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.bundle/
2+
log/*.log
3+
pkg/
4+
test/dummy/db/*.sqlite3
5+
test/dummy/log/*.log
6+
test/dummy/tmp/

test/fixtures/engine_project/Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source 'http://rubygems.org'
2+
3+
gem 'rails', "~> 3.1.0.rc4"
4+
gem 'sqlite3'
5+
6+
# Asset template engines
7+
gem 'sass-rails'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= EngineProject
2+
3+
This project rocks and uses MIT-LICENSE.

test/fixtures/engine_project/Rakefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env rake
2+
begin
3+
require 'bundler/setup'
4+
rescue LoadError
5+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6+
end
7+
begin
8+
require 'rdoc/task'
9+
rescue LoadError
10+
require 'rdoc/rdoc'
11+
require 'rake/rdoctask'
12+
RDoc::Task = Rake::RDocTask
13+
end
14+
15+
RDoc::Task.new(:rdoc) do |rdoc|
16+
rdoc.rdoc_dir = 'rdoc'
17+
rdoc.title = 'EngineProject'
18+
rdoc.options << '--line-numbers'
19+
rdoc.rdoc_files.include('README.rdoc')
20+
rdoc.rdoc_files.include('lib/**/*.rb')
21+
end
22+
23+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24+
load 'rails/tasks/engine.rake'
25+
26+
27+
Bundler::GemHelper.install_tasks
28+
29+
require 'rake/testtask'
30+
31+
Rake::TestTask.new(:test) do |t|
32+
t.libs << 'lib'
33+
t.libs << 'test'
34+
t.pattern = 'test/**/*_test.rb'
35+
t.verbose = false
36+
end
37+
38+
39+
task :default => :test

test/fixtures/engine_project/app/assets/images/engine_project/.gitkeep

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This is a manifest file that'll be compiled into including all the files listed below.
2+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3+
// be included in the compiled file accessible from http://example.com/assets/application.js
4+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5+
// the compiled file.
6+
//
7+
//= require jquery
8+
//= require jquery_ujs
9+
//= require_tree .
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
3+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4+
* the top of the compiled file, but it's generally better to create a new file per style scope.
5+
*= require_self
6+
*= require_tree .
7+
*/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module EngineProject
2+
class ApplicationController < ActionController::Base
3+
end
4+
end
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module EngineProject
2+
module ApplicationHelper
3+
end
4+
end

0 commit comments

Comments
 (0)