rails assets pipeline “Cannot allocate memory – nodejs”

It’s simple to spend the three minutes (maybe two if you type fast) to add a swap file to your server. If you’re running Ubuntu (not sure how well this works for other Linux flavors), just follow this tutorial from DigitalOcean: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04 Voila!

How do I set up a Rails Angular project to test JS?

You can use teaspoon it runs your favorite test suite (default is jasmine) and they have a wiki to integrate with angular. Teaspoon integrates with the asset pipeline, so you can throw all the angular gems in there and require them in the teaspoon generated spec_helper.js. The other cool thing is: they have a guard … Read more

what does ?body=1 do in rails 3.1 asset pipeline?

Trawling through the Sprocket source code we find: # Returns a 200 OK response tuple def ok_response(asset, env) if body_only?(env) [ 200, headers(env, asset, Rack::Utils.bytesize(asset.body)), [asset.body] ] else [ 200, headers(env, asset, asset.length), asset ] end end body_only? is set when ?body=1 or true For a static asset, Asset.body is defined as: def body # … Read more

What exactly “config.assets.debug” setting does?

This option’s effect is well described in this post, but I’ll summarize it here as well. The value of changing config.assets.debug lies in a compromise between page load time in development and ease of debugging. Basically: config.assets.debug = true: assets are served individually, organized just as you see them in development. Preprocessed languages like SASS … Read more

Rails asset pipeline solution for IE 4096 selector/stylesheet limit

We have an automated (albeit somehow awkward) solution working in production for a Rails 3.1 app with asset pipeline in place. Ryan already referenced the solution in his question but I try to come up with a more comprehensive answer. The asset pipeline pipes an asset through different Sprocket engines. So you might have e.g. … Read more

Rails: How do I create a custom 404 error page that uses the asset pipeline?

For Rails 4.1 I like this answer, add an asset type better; however I have not tried it. On Rails 4.0.8, these three references helped me: Dynamic error pages is the second reference in the question. This worked just fine for me. Custom error pages may have cribbed from the first reference, or the other … Read more