Giter Club home page Giter Club logo

Comments (5)

barrywoolgar avatar barrywoolgar commented on June 1, 2024 1

Hi @markets all that makes a lot of sense, thank you for the rapid response.

You're right, I had the Sprockets railtie commented out. However, this happens by default when the project is initialised with rails new my_app --skip-sprockets so I may not be the only one to run into this.

As such, I do think it's worth allowing for the absence of config.assets - and maybe displaying a warning when the generator is run? - so that just installing the gem doesn't risk "breaking" a streamlined app just by being in the Gemfile.

It's definitely an edge case though (and now this issue exists for anyone searching with the same exception), so I'd be happy to close this issue - unless you'd like a PR to address the boot crash issue?

from maily.

barrywoolgar avatar barrywoolgar commented on June 1, 2024 1

Hello, apologies for the delay in replying. I'm juggling some things at the moment, but I haven't forgotten!

from maily.

markets avatar markets commented on June 1, 2024

Hi @barrywoolgar and thanks for such a detailed description!

I usually use this gem in several apps with webpacker with no problem, but that's because I still use sprockets in combination (js -> webpack, css+images -> sprockets), so we don't faced the problem yet.

There is no "clear" way to use webpacker in Rails engines currently (https://github.com/rails/webpacker/blob/master/docs/engines.md), and at the same time keep compatibility with the sprockets version. From what I read in different issues and see in other gems with assets, it's possible, but still tricky and harder to maintain.

So I'd say, we have 2 feasible options to solve this situation:

a) as you pointed out above, provide "static" versions of the assets and inject a middleware to render those ones.
b) make maily depend on sprocket-rails (and load require "sprockets/railtie"), so config.assets will we available.

I think the first option a will be nice (no extra deps and we can cut sass dep too) but requires some analysis, work and testing. I'd try to go with b for now (If I'm not wrong, sprocket-rails is still a Rails 6 dep), so probably you only need to: require "sprockets/railtie" in config/application.rb.

Maybe in the future, if finally Rails settles to one pipeline approach, this will be easier for engines too.

from maily.

markets avatar markets commented on June 1, 2024

Yes, I think it's also commented out when you create a Rails API project.

As such, I do think it's worth allowing for the absence of config.assets - and maybe displaying a warning when the generator is run? - so that just installing the gem doesn't risk "breaking" a streamlined app just by being in the Gemfile.

Yeah! +1 to improve user experience and guidance for a friendly installation! --skip-sprockets and --api probably aren't not so rare these days.

from maily.

markets avatar markets commented on June 1, 2024

Closed by #48

from maily.

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.