GithubHelp home page GithubHelp logo

Comments (9)

netzpirat avatar netzpirat commented on July 21, 2024

Can you try setting

config.assets.initialize_on_precompile = true

in your config/environments/production.rb?

from haml_coffee_assets.

ar7hur avatar ar7hur commented on July 21, 2024

You are the best !

I thought I did it, but I did not. It works perfectly. Congrats for the great job, this gem is changing my life :)

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

Glad to hear you like it! The hint came from @thibaudgg and I thought it only applies to Heroku. I'll update the README.

from haml_coffee_assets.

thibaudgg avatar thibaudgg commented on July 21, 2024

It always happens when you compile your assets in production mode.

from haml_coffee_assets.

axs89 avatar axs89 commented on July 21, 2024

This is an awesome gem, thanks. I did have one question specifically about this before I dig into it too much. I was wondering why it needed the full environment to precompile the assets (specifically the initialize_on_precompile flag in production). To make a long story short with my project on Heroku this is making me have to precompile assets before deploy, which I'd rather not do. If it's not too bad I'd be willing to dig in and try to relax this dependency, but I thought I'd ask about it first, because there might be a very legitimate reason that the dependency on the environment exists (or maybe it's just too difficult to pull it out). Thanks!

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

I haven't played with the initialize_on_precompile flag yet and the docs aren't very clear on this. What does partially in "you can partially load your application" mean? I don't know which parts are loaded or not.

from haml_coffee_assets.

axs89 avatar axs89 commented on July 21, 2024

Yeah, it's definitely a little confusing, and the docs don't help much. The main side effect of that flag (for me) is that it loads the entire rails environment, and initializers and other code that looks for a database connection will be allowed to run. That presents a bit of an issue when you're deploying to Heroku and want to compile resources at slug compilation (they have a writeup on the issue).

In any case other types of assets don't require the full environment and I suspect that we could probably get these hamlc templates compiled without it, so I'll dig around a bit and see if I can come up with something.

from haml_coffee_assets.

netzpirat avatar netzpirat commented on July 21, 2024

The only dependencies are the execjs gem for compiling and rails for registering the engine. I remember I saw another asset pipeline gem that had a dependency to the railtie gem and not rails. Perhaps worth giving it a try.

from haml_coffee_assets.

axs89 avatar axs89 commented on July 21, 2024

I think I got it (just sent a pull request). Turns out it was a relatively straightforward option to the Railtie initialization.

from haml_coffee_assets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.