diff --git a/features/sprockets_gems.feature b/features/sprockets_gems.feature index 9fdc5104..2e2e4d09 100644 --- a/features/sprockets_gems.feature +++ b/features/sprockets_gems.feature @@ -2,4 +2,9 @@ Feature: Sprockets Gems Scenario: Sprockets can pull jQuery from gem Given the Server is running at "sprockets-app" When I go to "/library/js/jquery_include.js" - Then I should see "var jQuery =" \ No newline at end of file + Then I should see "var jQuery =" + + # Scenario: Sprockets can pull CSS from gem + # Given the Server is running at "sprockets-app" + # When I go to "/library/css/bootstrap_include.css" + # Then I should see "Bootstrap" \ No newline at end of file diff --git a/fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss b/fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss new file mode 100644 index 00000000..e8b1875e --- /dev/null +++ b/fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss @@ -0,0 +1 @@ +//= require "bootstrap.scss" \ No newline at end of file diff --git a/lib/middleman/cli.rb b/lib/middleman/cli.rb index 9a5846af..ac588200 100644 --- a/lib/middleman/cli.rb +++ b/lib/middleman/cli.rb @@ -12,7 +12,7 @@ module Middleman help_check if options[:help] end - desc "init NAME", "Create new Middleman project directory NAME" + desc "init NAME [options]", "Create new Middleman project directory NAME" available_templates = Middleman::Templates.registered_names.join(", ") method_option "template", :aliases => "-T", :default => "default", :desc => "Optionally use a pre-defined project template: #{available_templates}" method_option "css_dir", :default => "stylesheets", :desc => 'The path to the css files' diff --git a/lib/middleman/core_extensions/sprockets.rb b/lib/middleman/core_extensions/sprockets.rb index 7ba27766..46836bf4 100644 --- a/lib/middleman/core_extensions/sprockets.rb +++ b/lib/middleman/core_extensions/sprockets.rb @@ -23,11 +23,18 @@ module Middleman::CoreExtensions::Sprockets app.after_configuration do js_env = Middleman::CoreExtensions::Sprockets::JavascriptEnvironment.new(app) - js_dir = File.join("vendor", "assets", "javascripts") + vendor_dir = File.join("vendor", "assets", "javascripts") gems_with_js = ::Middleman.rubygems_latest_specs.select do |spec| - ::Middleman.spec_has_file?(spec, js_dir) + ::Middleman.spec_has_file?(spec, vendor_dir) end.each do |spec| - js_env.append_path File.join(spec.full_gem_path, js_dir) + js_env.append_path File.join(spec.full_gem_path, vendor_dir) + end + + app_dir = File.join("app", "assets", "javascripts") + gems_with_js = ::Middleman.rubygems_latest_specs.select do |spec| + ::Middleman.spec_has_file?(spec, app_dir) + end.each do |spec| + js_env.append_path File.join(spec.full_gem_path, app_dir) end # add paths to js_env (vendor/assets/javascripts) @@ -38,11 +45,19 @@ module Middleman::CoreExtensions::Sprockets app.after_compass_config do css_env = Middleman::CoreExtensions::Sprockets::StylesheetEnvironment.new(app) - css_dir = File.join("vendor", "assets", "stylesheets") + + vendor_dir = File.join("vendor", "assets", "stylesheets") gems_with_css = ::Middleman.rubygems_latest_specs.select do |spec| - ::Middleman.spec_has_file?(spec, css_dir) + ::Middleman.spec_has_file?(spec, vendor_dir) end.each do |spec| - css_env.append_path File.join(spec.full_gem_path, css_dir) + css_env.append_path File.join(spec.full_gem_path, vendor_dir) + end + + app_dir = File.join("app", "assets", "stylesheets") + gems_with_css = ::Middleman.rubygems_latest_specs.select do |spec| + ::Middleman.spec_has_file?(spec, app_dir) + end.each do |spec| + css_env.append_path File.join(spec.full_gem_path, app_dir) end app.map "/#{app.css_dir}" do diff --git a/middleman-x86-mingw32.gemspec b/middleman-x86-mingw32.gemspec index 1a7cb431..7bb1eb7d 100644 --- a/middleman-x86-mingw32.gemspec +++ b/middleman-x86-mingw32.gemspec @@ -70,5 +70,6 @@ eos s.add_development_dependency("rake", ["~> 0.9.2"]) s.add_development_dependency("rspec", ["~> 2.6.0"]) s.add_development_dependency("jquery-rails") + s.add_development_dependency("bootstrap-rails") end diff --git a/middleman.gemspec b/middleman.gemspec index f29098b2..12bc69c7 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -67,5 +67,6 @@ eos s.add_development_dependency("rake", ["~> 0.9.2"]) s.add_development_dependency("rspec", ["~> 2.6.0"]) s.add_development_dependency("jquery-rails") + s.add_development_dependency("bootstrap-rails") end