<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Rails 3 Engines/Plugins and Static Assets</title>
	<atom:link href="http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/feed/" rel="self" type="application/rss+xml" />
	<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/</link>
	<description>More information than you cared to know about whatever I find cool</description>
	<lastBuildDate>Mon, 08 Aug 2011 13:18:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Les Nightingill</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-87</link>
		<dc:creator>Les Nightingill</dc:creator>
		<pubDate>Sat, 09 Apr 2011 19:08:43 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-87</guid>
		<description>Well I kinda solved the problem with blank assets, with a bit of hacking. Not sure if there will be side effects but would be interested if others can use this too. 

I moved my ::ActionDispatch::Static middleware up in the rack stack. Instead of app.middleware.use (as Jon has suggested, above) I inserted my engine&#039;s static-serving middleware near the top of the rack stack with
     app.middleware.insert_before ::Rack::Lock, ::ActionDispatch::Static, &quot;#{root}/public&quot;
and presto!</description>
		<content:encoded><![CDATA[<p>Well I kinda solved the problem with blank assets, with a bit of hacking. Not sure if there will be side effects but would be interested if others can use this too. </p>
<p>I moved my ::ActionDispatch::Static middleware up in the rack stack. Instead of app.middleware.use (as Jon has suggested, above) I inserted my engine&#8217;s static-serving middleware near the top of the rack stack with<br />
     app.middleware.insert_before ::Rack::Lock, ::ActionDispatch::Static, &#8220;#{root}/public&#8221;<br />
and presto!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Les Nightingill</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-86</link>
		<dc:creator>Les Nightingill</dc:creator>
		<pubDate>Sat, 09 Apr 2011 18:23:36 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-86</guid>
		<description>Just to add info to the problems that others (and I) are seeing with blank asset files being delivered...
The engine&#039;s asset files ARE being found (if I try to include a non-existent css file, I get http not found response, but the blank files include http 200, OK, code). But the content is empty! 
(OK locally on my dev machine, though).</description>
		<content:encoded><![CDATA[<p>Just to add info to the problems that others (and I) are seeing with blank asset files being delivered&#8230;<br />
The engine&#8217;s asset files ARE being found (if I try to include a non-existent css file, I get http not found response, but the blank files include http 200, OK, code). But the content is empty!<br />
(OK locally on my dev machine, though).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bala Paranj</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-83</link>
		<dc:creator>Bala Paranj</dc:creator>
		<pubDate>Sun, 06 Mar 2011 21:59:48 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-83</guid>
		<description>Symlinks is a workaround and not a ideal solution. Ideally you want a Rack app to handle all the static assets (html, css, js, images etc). Any pointers on how to do that?</description>
		<content:encoded><![CDATA[<p>Symlinks is a workaround and not a ideal solution. Ideally you want a Rack app to handle all the static assets (html, css, js, images etc). Any pointers on how to do that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cowboycoded.com</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-69</link>
		<dc:creator>cowboycoded.com</dc:creator>
		<pubDate>Mon, 03 Jan 2011 15:12:47 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-69</guid>
		<description>Thanks Jon.  I found this to be helpful in including some static assets from my engine in my main rails app, but I wanted to append these assets to my main rails app public dir, and not replace the public directory altogether.  I ended up using the engine initializer, but I just created symlinks to the files from the plugin directory to the app directory:

initializer &quot;static assets&quot; do &#124;app&#124;
        system(&quot;ln -nfs #{root}/public/stylesheets/* #{app.root}/public/stylesheets/&quot;)
        system(&quot;ln -nfs #{root}/public/javascripts/* #{app.root}/public/javascripts/&quot;)
end</description>
		<content:encoded><![CDATA[<p>Thanks Jon.  I found this to be helpful in including some static assets from my engine in my main rails app, but I wanted to append these assets to my main rails app public dir, and not replace the public directory altogether.  I ended up using the engine initializer, but I just created symlinks to the files from the plugin directory to the app directory:</p>
<p>initializer &#8220;static assets&#8221; do |app|<br />
        system(&#8220;ln -nfs #{root}/public/stylesheets/* #{app.root}/public/stylesheets/&#8221;)<br />
        system(&#8220;ln -nfs #{root}/public/javascripts/* #{app.root}/public/javascripts/&#8221;)<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hussein Morsy</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-66</link>
		<dc:creator>Hussein Morsy</dc:creator>
		<pubDate>Thu, 16 Dec 2010 07:44:02 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-66</guid>
		<description>In production mode all assets (stylesheets, images, javascripts) from the engines are empty. Any solution ?</description>
		<content:encoded><![CDATA[<p>In production mode all assets (stylesheets, images, javascripts) from the engines are empty. Any solution ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Swope</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-52</link>
		<dc:creator>Jon Swope</dc:creator>
		<pubDate>Mon, 11 Oct 2010 15:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-52</guid>
		<description>I think this is due to the way that Rails compiles the stylesheets together for prod.  This technique is for serving static assets from your app, however the method in which it works doesn&#039;t cause your main app to suddenly become &quot;aware&quot; of your plugin&#039;s public directories.  All it does is add itself to the middleware stack to intercept requests for assets as they come in.

I&#039;ll take a look into the code a bit deeper and see if there&#039;s some way to do what you are looking for, but I&#039;m not extremely hopeful as there was no way to handle this without the middleware.</description>
		<content:encoded><![CDATA[<p>I think this is due to the way that Rails compiles the stylesheets together for prod.  This technique is for serving static assets from your app, however the method in which it works doesn&#8217;t cause your main app to suddenly become &#8220;aware&#8221; of your plugin&#8217;s public directories.  All it does is add itself to the middleware stack to intercept requests for assets as they come in.</p>
<p>I&#8217;ll take a look into the code a bit deeper and see if there&#8217;s some way to do what you are looking for, but I&#8217;m not extremely hopeful as there was no way to handle this without the middleware.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason L Perry</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-51</link>
		<dc:creator>Jason L Perry</dc:creator>
		<pubDate>Mon, 11 Oct 2010 14:28:05 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-51</guid>
		<description>Roger, I&#039;m having the same issue. Did you find a solution?</description>
		<content:encoded><![CDATA[<p>Roger, I&#8217;m having the same issue. Did you find a solution?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-45</link>
		<dc:creator>Roger</dc:creator>
		<pubDate>Tue, 21 Sep 2010 10:38:04 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-45</guid>
		<description>I wanna use this in production mode but when I do, the stylesheet files are empty when loaded. Any ideas?</description>
		<content:encoded><![CDATA[<p>I wanna use this in production mode but when I do, the stylesheet files are empty when loaded. Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Schacht</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-43</link>
		<dc:creator>Keith Schacht</dc:creator>
		<pubDate>Tue, 14 Sep 2010 04:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-43</guid>
		<description>Thanks for your help Jon!  I&#039;ve incorporated Jon&#039;s tips and many other tips for rails engines into a nice engine starting point:

http://keithschacht.com/creating-a-rails-3-engine-plugin-gem</description>
		<content:encoded><![CDATA[<p>Thanks for your help Jon!  I&#8217;ve incorporated Jon&#8217;s tips and many other tips for rails engines into a nice engine starting point:</p>
<p><a href="http://keithschacht.com/creating-a-rails-3-engine-plugin-gem" rel="nofollow">http://keithschacht.com/creating-a-rails-3-engine-plugin-gem</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Schacht &#187; Blog Archive &#187; Creating a rails 3 engine / plugin / gem &#8211; Keith Schacht&#8217;s blog</title>
		<link>http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/comment-page-1/#comment-42</link>
		<dc:creator>Keith Schacht &#187; Blog Archive &#187; Creating a rails 3 engine / plugin / gem &#8211; Keith Schacht&#8217;s blog</dc:creator>
		<pubDate>Mon, 13 Sep 2010 04:55:47 +0000</pubDate>
		<guid isPermaLink="false">http://jonswope.com/?p=68#comment-42</guid>
		<description>[...] Modest Rubyist, Jon Swope, Rails Dispatch Filed under: GeekKeith   Get notified of new [...]</description>
		<content:encoded><![CDATA[<p>[...] Modest Rubyist, Jon Swope, Rails Dispatch Filed under: GeekKeith   Get notified of new [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

