Questions tagged [asset-pipeline]

The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass and ERB.

The asset pipeline is a feature added to Ruby on Rails 3.1 to provide improved organization and processing for JavaScript, stylesheets, and images. There also exists a Grails plugin named asset-pipeline that provides equivalent functionality to applications developed for this framework.

These assets can be separated into folders under app/assets/ for those that are application-specific, lib/assets/ for assets shared across multiple applications, and vendor/assets/ for third-party assets. Each of those folders would have subfolders like javascripts/, stylesheets/ and images/.

This is meant to eliminate what Ruby on Rails creator David Heinemeier Hansson calls the "junk drawer" approach of putting all JavaScript code (for example) in the same folder, regardless of source.

Additionally, as Ryan Bigg has documented:

The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, SCSS and ERB. -- Rails Guides

3569 questions
1
vote
1 answer

Access bevy asset right after loading via AssetServer

Is it possible to access a bevy asset right after it was loaded from the AssetServer? I've read actual loading happens in the background but couldn't find in either official documentation or the bevy cheat book if it is possible to wait for the…
mpellie
  • 11
  • 1
1
vote
1 answer

Preprocess SCSS with HAML

I have an app that has some categories: Tomato, Orange, Banana. Each category has it's own color saved in the database: FF0000, FF6600, FFFF00. There're also some posts in the app that belong to a category. I want HAML and/or SASS to generate…
Ivan
  • 874
  • 10
  • 32
1
vote
1 answer

Rails in production is not finding my assets in the public directory

I have a really weird bug, a few hours after i start rails in production it stops being able to locate my assets. The weirdest thing is that i can "fix" by starting in development and then production works for a couple of hours and the cycle…
Melfric
  • 11
  • 1
1
vote
1 answer

Sprockets::DoubleLinkError: Multiple files with the same output path cannot be linked ("application.js") in Rails 7

Sprockets::DoubleLinkError: Multiple files with the same output path cannot be linked ("application.js") in Rails 7. After compiling assets: Here is my manifest.json: Directory structure:
1
vote
2 answers

Rails 3.1 assets and layout troubles

I have a rails 3.1 application that uses a default layout with css in "/app/assets/stylesheets/application.css" as per standard practice. This works great with the asset pipelining stuff for the main part of my application. But I use a different…
Greg B
  • 551
  • 4
  • 10
1
vote
1 answer

How to get debug mode for CSS?

<%= stylesheet_link_tag 'application', :debug => Rails.env.development? %> Doesn't seem like its working. I think the asset is still being precompiled... I can verify this because firebug ain't reporting the right lines.
Christian Fazzini
  • 19,613
  • 21
  • 110
  • 215
1
vote
0 answers

rails 3.1 assets pipeline + acceptance test

we have a rather extensive acceptance test suite, running on our CI server triggered by a Github push hook. i'd like to add a feature or spec to basically test wether rake assets:precompile runs smoothly. we run this task usually in a capistrano…
Marian Theisen
  • 6,100
  • 29
  • 39
1
vote
3 answers

rails 3.1 maintenance page assets

How do I access assets on my maintenance page in rails 3.1 with the asset pipeline enabled? With the asset pipeline enalbed all assets have a hash in their filename. However, maintenance pages are vanilla HTML, and rails/passenger is being bypassed…
jsharpe
  • 2,546
  • 3
  • 26
  • 42
1
vote
0 answers

how to refer to a rails image asset in JSX and Rails 7 (esbuild)

Can't figure out how to get an asset path in JSX that is processed byjsbundling-rails/esbuild: I've seen that in the source code of cssbundling-rails the url() is gsubbed and urls are replaced with the whole…
pixelearth
  • 13,674
  • 10
  • 62
  • 110
1
vote
1 answer

Stimulus controllers not getting loaded

I am updated a Rails 6 app to Rails 7 and using importmaps and Leaflet. I am following How do I use Leaflet in Rails 7?. I successfully build a new app and it works fine, but upgrading my old app does not. What am I missing? Or what debugging steps…
Greg
  • 2,359
  • 5
  • 22
  • 35
1
vote
0 answers

Adding FullCalendar to React on Rails project causes DoubleLinkError in application.css

I have a React project served using Ruby on Rails 7. It's set up using this tutorial (source code available here); I'm at the part where you add React Router so you can add a second page to the app. I ran yarn add @fullcalendar/react…
1
vote
1 answer

"allow the origin of the assets in your Rails config file" ? (Heroku to Railway - no styling, images not loading)

along with many others it would seem, I have attempted to shift my hobby apps from Heroku to Railway. I haven’t had tremendous success as both of the apps I’ve transferred (which work fine locally and on Heroku) experience the same problem on…
Dan SimBed
  • 133
  • 1
  • 11
1
vote
2 answers

Rails 3.1 Images Broken in Stylesheets

I've been running a small application that I originally wrote under Rails 3.1.0.rc4. Last night I began the transition to 3.1.0 final. Well I hit a frustrating snag in the asset pipeline. My js is fine, my css is fine; however, images included on…
loneaggie
  • 297
  • 2
  • 8
1
vote
0 answers

Upgraded to Rails 6.1 and DartSass - now no JS assets are found

I recently upgraded to Dartsass: gem "dartsass-rails", "~> 0.4.0". Now my Javascript assets are broken... Specifically: application-2780ff1b190fd971bdc5.js:1 Failed to load resource: the server responded with a status of 404 (Not…
tfantina
  • 788
  • 11
  • 37
1
vote
1 answer

How to include @apply CSS code for reusing TailwindCSS styles with tailwindcss-rails?

I’m using tailwindcss-rails gem in Rails 7 project with asset pipeline. I need to reuse TailwindCSS styles, for example: .pagy-nav { @apply flex space-x-2; } I can put this code in app/assets/stylesheets/application.tailwind.css file and it…
Evgenii
  • 36,389
  • 27
  • 134
  • 170
1 2 3
99
100