Open mrrooijen opened 13 years ago
Hi meskyanichi,
This is something that I ran into when using heroku as well. Even if you could write the javascripts and css to the /tmp directory, could you access them in a web browser? I would be open to other ideas if you have them. The best solution would be the following: https://github.com/thumblemonks/smurf/issues/closed#issue/8
Hope this helps.
Yeah. People that use Compass/SASS to compile Stylesheets on Heroku also compile it to Heroku and tell Rack to look in the tmp dir for the stylesheets.
Check this out: https://gist.github.com/716284
It's a Gist for Compass/Stylesheets compiled to the tmp/stylesheets/compiled
dir and serve them from there as if they were in the public/stylesheets/compiled
directory.
I am quite sure that if you'd compress your javascripts to tmp/javascripts
you could do this in your Rails.root/config.ru
.
use Rack::Static, :urls => ["/javascripts"], :root => "tmp"
Which would read them from tmp/javascripts
.
Only thing is that I don't know how to compile Javascripts with Smurf to a location out side of the Rails.root/public
directory.
Let me just add:
Basically what needs to happen is this:
app/views/layouts/application.html.erb <%= javascript_include_tag "jquery", "rails", "application", :cache => true %>
The above could should compile the all.js
file to tmp/javascripts/all.js
. Then in the browser's source you would see something like:
<script src="/javascripts/all.js"></script>
Then adding this in the Rails.root/config.ru
use Rack::Static, :urls => ["/javascripts"], :root => "tmp"
It should find the tmp/all.js
and load it if I am correct.
@peppyheppy - Thanks for replying.
@meskyanichi - Do you need any more help with this?
Yeah I actually never figured it out. As mentioned above it should be possible to read out the javascript files from the tmp/ dir like you would with css (when using sass) and deploying to heroku.
I believe that if Smurf could compress/merge all the JS files in to the /tmp dir (optionally) then people could benefit a lot from that when deploying to heroku. I assume it currently isn't possible to do this, but are there any plans to allow the compressed JS files to be created in the tmp/javascripts dir for example? (outside of the public dir)
Howdy,
If you can put together any sort of pull-request or even just gist I think that would help a lot in making this a reality. As I stated in another feature request, I haven't needed to have a lot of intimate time with smurf lately and I get a bit disconnected from making improvements to it. Any "physical" research you can do into this would help tremendously.
Is that fair?
Cheers, Gus
Hey, I'm deploying an app to Heroku and was wondering if it's possible to compile javascripts such as:
in to
Rails.root/tmp/javascripts
rather thanRails.root/public/javascripts
since that's the only writable directory on Heroku. It's not possible to do the following:Any idea's how I can accomplish this?
Thanks!