Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Works in dev but not in production(?) #62
Comments
|
Now I'm able to get it to include just one js and one css file but the routes for those URLs respond with a blank document :( |
|
Having the same issue here. It works fine in :development but in :production, the app.css file is empty and the app.js file contains a single semicolon. |
|
Looks like something that occurred to me that I fixed, could you try with latest version? |
|
Could you also provide logs? |
|
I'm experiencing the same problem. Everything works great in development but when I run in production the single js and css files are empty. I'm using sinatra-assetpack 0.1.5. I've ran What other info/logs can I provide you to help troubleshoot this issue? |
|
Are you using LESS too @marks? The following app I made is working with less & assetpack on heroku, maybe you can have a look at it : |
|
@j15e thanks for your help. I compared your seaoo-web app w/ my code and the only thing I noticed that was different was the paths used for the css bootstrap import statements. I'm using I'm using Padrino w/ my app. I created a basic padrino app with the sinatra-assetpack and I'm able to reproduce this error. I uploaded this project to github here: https://github.com/gregjopa/padrino_bootstrap_demo The app runs fine in development and loads all the bootstrap css files successfully. However, when its run in production the asset compilation fails with the following error: This definitely seems like a LESS issue. Any ideas on how I can resolve this? |
|
This line of code
I am still experiencing this "works in development but fails in production" problem with another padrino app. The difference between my working app and my broken app is my broken app does not have a folder named |
|
Sorry to get back with you much later! I have found two issues that were causing me the issue above: Using sinatra-assetpack (0.1.2) 1.) extra dots in the filename. jquery.validate.js <-- the version I was using didn't like this; I replaced extra dots with dashes and things worked again. Ran into the issue again...and this time... 2.) had two files app/js/coffee/cwo.coffee and app/js/coffee/models/cwo.coffee -- this caused a error that was very hard for me to catch (due to my NTLMv2 auth setup. :( ) -- I stumbled upon it when syncing to a known good state and noticed the extra cwo.coffee file outside the models dir, which should not have been there. I nuked that file, restarted the production web process and boom, application.js contained all the data that was supposed to be there. In short: dupe file names, even on different paths, muck up the compilation. Sadly, I have no trace of where this is happening. |
|
Same problem here. It doesn't work in production. The files that are supposed to have all the assets compressed, are empty. |
|
Check the above two issues: extra dots in the file names and duplicate files in the app/js/* directories. Since fixing those in my local apps, I've had no issues at all. One of these evenings, I'll purposedly break on to get a trace or something for this post. (Just too busy to worry about it now that it work. :( ) |
|
I'm not changing filenames just to make this work. |
|
Unfortunately, same here. No clue found yet. |
|
So bad it just happens is production environment, just when you though it worked! I ended up using jammit for sinatra. It's fairly simple and you have more control of where your assets get stored and stuff like that. Also, you need to use some Padrino View helpers that might now work as expected if your using Sinatra helpers. |
|
Where do you deploy and could you provide mode details? I can't see the common factor between theses issues yet |
|
@gregjopa I have installed & run your demo |
|
@alanandrade I also ended up using sprockets and yui-compressor directly instead of using sinatra-assetpack; this combo made it light-speed fast. @j15e I run it with rackup -Eproduction but no hope. |
|
Just FYI, I also use sprockets on some projects but I'd like to maintain & keep sinatra-assetpack as an alternative that is lightweight & very easy to use with sinatra. |
|
@j15e yeah, sinatra-assetpack seems like a good player for sinatra assets. Not very flexible in my opinion, but still, we can improve it! |
|
Hi everybody, any new development on this issue? Have any new version fixed the issue? |
|
We should pair sometime soon to fix it man. I think this gem is great. |
|
I had this problem as well, and it turned out that asset-pack was unable to overwrite the destination file that existed on disk already. The reason it was there was because I was trying out the rake task and it built all my stuff and dropped it into the destination file ("/stylesheets/application.css"). It was empty in the beginning because I screwed some stuff up - but once I deleted the directories (the destination) all worked fine - even with the extra dots :). |
|
OK - a further update, and I believe I have solved this. When you run a Sinatra/Padrino app in dev, the "root" of your app is ... well the root of your directory. So if you have an "/app" file, asset-pack will find it right where you specifiy: at "/app". However, in production, when you push with Capistrano the root of your app (if you using Unicorn or Passenger) is "current/public", so when asset-pack tries to find your css or js files, it will be looking in "/current/public/css" as opposed to where you told it to look. This happens, apparently, because :root is set to File.dirname(FILE) which, in production, is "current/public". I verified this by creating symlinks in a "public/app" directory for "css" and "js". Then, magically, everything worked. Hope this helps someone and, also, I hope it can be tracked and fixed (forking now) |
|
sorry but I am giving up this gem. what a waste of time. I could list numerous examples of odd behaviour, especially in production. But I am too fed up now with this. |
|
@reicheltd sprocket is rack compatible and I would say is the currently recommended assets solution for Sinatra & Padrino for any new project. You should find many solutions if you look for sprockets + sinatra on internet. |
|
@j15e To be clear are you saying to use Sprockets instead of this gem now? |
|
Yes Le samedi 22 février 2014, Esop notifications@github.com a écrit :
|
|
POSSIBLE FIX: I had the same problem. In my case I was filtering requests based on the host name This gem uses If result.body is empty, you end up with some or all of the content missing In my case I was enforcing a host name redirect and so result.body was empty I worked around the issue by avoiding the redirect in the case the host name was This fixed the problem allowing the resources to be served. I can imagine similar problems if you have resources behind authentication or other
Is the place to look Happy New Year |
|
@stujo Could you provide more info about your solution? I ran into this issue, using a gem which depends on sinatra-assetpack in a Rack app which uses |
Here's what I have in my app.rb.
Then, in my layout.haml, I have:
!= css :mainand!= js :main. The problem is, though, whether I'm in development or production mode, thecssandjshelpers render HTML to load the actual files and not a stitched nor compressed version.Anyone else had this happen or have ideas for me?
Thanks so much in advance!
Mark