Git Product home page Git Product logo

Comments (6)

tian-im avatar tian-im commented on June 26, 2024

I'm not sure if Webpack is supported for a Rails engine, not from what I can see in Rails 5. But yeah, I can take a look and see if it can be done.

from wallaby-rails.

ryanb avatar ryanb commented on June 26, 2024

From my understanding there's no way to add node dependencies through a gem so you can't use it through an engine the same way sprockets is used. You can still do it, but the the node dependency needs to be added separately.

For example, let's say you have a wallaby-webpacker gem which is designed to work with webpacker instead of sprockets. To install it you'd do:

gem install wallaby-webpacker
yarn add wallaby-rails # or whatever you name the module

Then they need to generate a pack file:

// in app/javascript/packs/wallaby.js
import 'wallaby-rails'

Then the wallaby layout needs to link to that pack:

<%= stylesheet_pack_tag "wallaby", media: "all" %>
<%= javascript_pack_tag "wallaby" %>

Perhaps supply a generator to do these steps.

Why do we want this? Currently Wallaby depends on these gems: bootstrap, bootstrap4-datetime-picker-rails, jquery-rails, momentjs-rails, sass-rails, font-awesome-sass. These are all front-end dependencies and our app is using the node versions. This duplicates the dependencies of our app for all of these assets, and every deploy generates two copies of these dependencies: one through sprockets and another through webpack.

In theory we could remove sprockets entirely if wallaby didn't use it.

from wallaby-rails.

tian-im avatar tian-im commented on June 26, 2024

Yeah, I totally understand why everyone wants it these days. Let me do some experiments and see.

from wallaby-rails.

leomao10 avatar leomao10 commented on June 26, 2024

This is some extra information about how to include assets in engines:
https://github.com/rails/webpacker/blob/master/docs/engines.md

from wallaby-rails.

tian-im avatar tian-im commented on June 26, 2024

@leomao10 try this: rails/webpacker#348 (comment)

from wallaby-rails.

ryanb avatar ryanb commented on June 26, 2024

Since Webpacker is retired, I suggest not doing what I recommended above. I'm closing this issue.

from wallaby-rails.

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.