0

I just created a brand new Ruby on Rails 8.0.1 app with Propshaft included. I got the SCSS part working but I can't seem to get the JavaScript part working.

Unlike with most other apps, I have only a bunch of static JS files that I want to combine into one big file, e.g. application.js. I don't need modules nor do I need Importmaps.

When using Sprockets in my previous app, I could simple put this into my application.js file:

//= require_tree . 

And it would combine all my 50 JS files into one big file.

How can something similar be achieved with Propshaft?

6
  • 1
    I am open to it. But I would have to re-factor each file a bit.
    – Tintin81
    CommentedFeb 25 at 17:34
  • 1
    Sure, it would need some re-factoring, but this re-factoring is the easier process than the opposite, when you merge everything. Limitation is scope and access is always a plus.CommentedFeb 25 at 20:55
  • 1
    you'd need to bundle it with jsbundling-rails. with importmap-rails there is no bundling, every file is separate.
    – Alex
    CommentedFeb 25 at 21:03
  • 2
    The whole reason sprockets combined your assets was that browsers at the time only supported a handful of paralell downloads which was a serious bottleneck. This is no longer the case and the whole idea behind the new default pipeline is a "no-build" strategy that leverages better browser technology. There are other pipelines if you need preprocessing.
    – max
    CommentedFeb 26 at 9:12
  • 1
    FYI Evolution of Asset Management Techniques
    – Stefan
    CommentedFeb 26 at 11:08

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.