diff options
author | adman65 <me@broadcastingadam.com> | 2012-03-22 12:05:28 +0100 |
---|---|---|
committer | adman65 <me@broadcastingadam.com> | 2012-03-22 12:05:28 +0100 |
commit | 5fdcda8b220af7042d4b5111fa16090ebaf16926 (patch) | |
tree | 1ead7f2af8066e86bcc431665a1074ba92ae744c | |
parent | 152798f6a6455c2df4b7db4a8779c946017de8d4 (diff) | |
download | rails-5fdcda8b220af7042d4b5111fa16090ebaf16926.tar.gz rails-5fdcda8b220af7042d4b5111fa16090ebaf16926.tar.bz2 rails-5fdcda8b220af7042d4b5111fa16090ebaf16926.zip |
[engines] [ci-skip] Add example of precompiling engine assets
-rw-r--r-- | guides/source/engines.textile | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/guides/source/engines.textile b/guides/source/engines.textile index 6ae9504c23..501d48eab8 100644 --- a/guides/source/engines.textile +++ b/guides/source/engines.textile @@ -723,6 +723,21 @@ You can also specify these assets as dependencies of other assets using the Asse */ </css> +h4. Separate Assets & Precompiling + +There are some situations where your engine's assets not required by the host application. For example, say that you've created +an admin functionality that only exists for your engine. In this case, the host application doesn't need to require +admin.css+ +or +admin.js+. Only the gem's admin layout needs these assets. It doesn't make sense for the host app to include +"blorg/admin.css"+ in it's stylesheets. In this situation, you should explicitly define these assets for precompilation. +This tells sprockets to add you engine assets when +rake assets:precompile+ is ran. + +You can define assets for precompilation in +engine.rb+ + +<ruby> +initializer do |app| + app.config.assets.precompile += %w(admin.css admin.js) +end +</ruby + For more information, read the "Asset Pipeline guide":http://guides.rubyonrails.org/asset_pipeline.html h4. Other gem dependencies |