diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2015-09-27 17:34:13 -0400 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2015-09-29 11:56:58 -0700 |
commit | 20ec1e922cc141364881b17e2509c4d7dccca695 (patch) | |
tree | 9bb87a716930bf6b056c8775928b89367647a6ea /railties/lib | |
parent | eb73c58003f4e71317800d5dd44d05af991351a3 (diff) | |
download | rails-20ec1e922cc141364881b17e2509c4d7dccca695.tar.gz rails-20ec1e922cc141364881b17e2509c4d7dccca695.tar.bz2 rails-20ec1e922cc141364881b17e2509c4d7dccca695.zip |
Eliminate overlapping `app/assets` load path
* Move `app/assets/manifest.js` to `app/assets/config/manifest.js`.
Avoid the suggestion that you can/should deep-link `stylesheets/foo`.
* Pull in all toplevel stylesheets and JavaScripts, not just
`application.js` and `.css`. Demonstrate how to use `link_directory`
with a specified `.js`/`.css` type.
* Fix RAILS_ENV handling in assets tests.
* Shush warnings spam from third-party libs that distract from tests.
Diffstat (limited to 'railties/lib')
5 files changed, 16 insertions, 16 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt b/railties/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt new file mode 100644 index 0000000000..f80631bac6 --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt @@ -0,0 +1,8 @@ + +<% unless options.api? -%> +//= link_tree ../images +<% end -%> +<% unless options.skip_javascript -%> +//= link_directory ../javascripts .js +<% end -%> +//= link_directory ../stylesheets .css diff --git a/railties/lib/rails/generators/rails/app/templates/app/assets/manifest.js.tt b/railties/lib/rails/generators/rails/app/templates/app/assets/manifest.js.tt deleted file mode 100644 index 3325553f57..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/app/assets/manifest.js.tt +++ /dev/null @@ -1,8 +0,0 @@ - -<% unless options.api? -%> -//= link_tree ./images -<% end -%> -<% unless options.skip_javascript -%> -//= link ./javascripts/application.js -<% end -%> -//= link ./stylesheets/application.css diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 8fea30189e..910c4e743e 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -106,7 +106,7 @@ task default: :test def test_dummy_assets template "rails/javascripts.js", "#{dummy_path}/app/assets/javascripts/application.js", force: true template "rails/stylesheets.css", "#{dummy_path}/app/assets/stylesheets/application.css", force: true - template "rails/dummy_manifest.js", "#{dummy_path}/app/assets/manifest.js", force: true + template "rails/dummy_manifest.js", "#{dummy_path}/app/assets/config/manifest.js", force: true end def test_dummy_clean @@ -124,7 +124,7 @@ task default: :test end def assets_manifest - template "rails/engine_manifest.js", "app/assets/#{underscored_name}_manifest.js" + template "rails/engine_manifest.js", "app/assets/config/#{underscored_name}_manifest.js" end def stylesheets diff --git a/railties/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js b/railties/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js index ace695a811..8d21b2b6fb 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js +++ b/railties/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js @@ -1,11 +1,11 @@ <% unless api? -%> -//= link_tree ./images +//= link_tree ../images <% end -%> <% unless options.skip_javascript -%> -//= link ./javascripts/application.js +//= link_directory ../javascripts .js <% end -%> -//= link ./stylesheets/application.css +//= link_directory ../stylesheets .css <% if mountable? && !api? -%> //= link <%= underscored_name %>_manifest.js <% end -%> diff --git a/railties/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js b/railties/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js index f8ef26982a..2f23844f5e 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js +++ b/railties/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js @@ -1,6 +1,6 @@ <% if mountable? -%> -<% unless options.skip_javascript -%> -//= link ./javascripts/<%= namespaced_name %>/application.js +<% if !options.skip_javascript -%> +//= link_directory ../javascripts/<%= namespaced_name %> .js <% end -%> -//= link ./stylesheets/<%= namespaced_name %>/application.css +//= link_directory ../stylesheets/<%= namespaced_name %> .css <% end -%> |