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.
3,568
questions
-1
votes
0
answers
56
views
Custom fonts in ruby on rails [closed]
I am currently facing an issue where the Google font family is being applied when the page reloads instantly. However, I want to ensure that my custom font family is always applied in my Ruby on Rails ...
0
votes
0
answers
22
views
How to load an Active Storage image into a canvas with a Stimulus controller?
I would like to load the images that users submit into the Stimulus controller so that I can use it within my Three JS (3D JavaScript Library) code. How can I achieve this? I’ve already tried so many ...
0
votes
0
answers
26
views
Trying to load Angular from Rails - "cannot use import statement outside a module"
I'm on a team that maintains a rather creaky old web application. The backend is in Rails; the frontend is based on Rails but in practice is mostly AngularJS.
The project I'm trying to do now is to ...
0
votes
0
answers
10
views
Assets links inside css are messed up in heroku staging app but not in review apps that use the same config
I have a rails app deployed to heroku that is deployed to a subdirectory in the following way.
In config.ru, we have
map '/diagnostics' do
run Rails.application
end
And in config/application.rb
...
2
votes
1
answer
114
views
Rails 5.1.7: Sprockets::Rails::Helper::AssetNotFound
we have a rails 5.1.7 application and all is working fine in the dev environment. but in staging environment or when running server using rails s -e staging, we see this error "Sprockets::Rails::...
0
votes
0
answers
10
views
CSS Background-image: url('foo'); not displaying after deploying my node.js app
I created a simple threejs website. When run it local the image displays correctly,
After running 'npm run build' and deploying the website, the image does not display and no error in the console.
I ...
0
votes
0
answers
8
views
Jquery-Datatables re-initializing on restroration visits
I am using rails 6 app which has turbolinks enabled. I have used jquery-data table on several pages. My issue is when I try to use browser' back and forth buttons, turbolinks performs restoration ...
0
votes
0
answers
60
views
Importmaps in rails 7
I am new to rails 7 and dont know where to put my custom js files.
Now I know the importmaps are used to get third part javascript libraries via cdn's and we include in our application.js file. But ...
0
votes
0
answers
45
views
Webpacker packs in rails 6 understanding
I am relatively new to rails and got stuck in webpacker entry points. Now I have worked with asset pipeline and thoroughly understand the concept of it. But When I started learning wepacker, I got ...
0
votes
0
answers
24
views
import normalize in rails asset-pipeline with esbuild
application.sass.scss in rails asset-pipeline doesn't recognize normalize import from node_modules.
this is import I am using @import "~normalize.css/normalize.css";.
this is the build ...
0
votes
0
answers
57
views
Can I install Bootstrap v4.6 with cssbundling-rails?
I have a Rails 6.1 app with the cssbundling-rails and jsbundling-rails apps.
This is an upgraded app using the asset pipeline.
I need to use bootstrap version 4.6, not latest bootstrap v5.
But rails ...
0
votes
1
answer
232
views
Rails 7 - React application not loading assets from subdirectory
I recently migrated a React-Rails application from rails 6 to 7. Since Webpacker was discontinued, I tried configuring Webpack on the javascript side.
The rails application is configured to load from ...
4
votes
1
answer
631
views
Rails 7/StimulusJS relative import: working on dev, but not production
I'm using Rails again after a few years away (last used Rails 4). I have multiple stimulus controllers that reference a file called metric_defaults.js. That file just contains a flat set of ...
1
vote
1
answer
41
views
Rails asset not precompiled
A page is returning the error AssetNotPrecompiledon a page in a Rails 6.0.3 application.
The layout attempts to initialise css variables in a first file, then load the bulk of css classes and finally ...
1
vote
1
answer
397
views
Import file as Javascript string
I have a long string that, due to its complex generation process, needs to go to a static file. I'd like to import it as a string variable, akin to:
// res.txt
The quick brown fox...
// code.js
...
0
votes
0
answers
38
views
Rails 7 asset pipeline missing bits?
In development, the application behaves as expected. However when deploying to production, the log complains about:
ActionView::Template::Error (The asset "dfull" is not present in the ...
2
votes
1
answer
610
views
Custom JS files in app/assets/javascripts/ break the Stimulus assets pipeline (Rails 7)
I'm trying to add custom JavaScript in a Ruby on Rails 7 project, so:
I created the file app/assets/javascripts/application.js containing my custom code.
In app/assets/config/manifest.js I added (...
0
votes
0
answers
141
views
Addressables not working in smaller Unity build
I'm working on a Unity project where I have implemented the Addressables system. However, I'm facing an issue where sometimes, when I get a player build with a smaller size than the average build, ...
1
vote
0
answers
78
views
Ruby on Rails 7.0 SyntaxError: Invalid character when attempting to load assets
When I attempt to use a tag to import a file from assets, whether it be through image_tag, stylesheet_link_tag or javascript_include_tag, I get "SyntaxError: Invalid character", which points ...
0
votes
1
answer
155
views
why won't javascript won't work (Rails 7 with esbuild)
I'm pretty new to Rails (version 7.0.4.2 with ruby 3.2.0, on an Intel-based Macbook Pro running Monterey 12.6). Here's a minimal example causing me problems:
I start a new project by doing
rails new ...
0
votes
0
answers
109
views
Rails/React CSS Style Rendering Issue
I'm building a card game application using Rails as by backend and React as my frontend. I'm using Rails 6.1.7.2 and Webpack to implement React. So far I have a Board component and a Game component. ...
1
vote
0
answers
63
views
Rails 7 with importmap and Stimulus not working on IOS
I'm facing a situation that I'm stuck for some time now.
I have an application that I recently updagraded from Rails 6 to Rails 7. Now I want to use Stimulus to replace some VueJS that I have.
What I ...
1
vote
0
answers
72
views
Rails 7 SassC Error: Bootstrap not found or unreadable while uploading on Heroku
I am upgrading my app from Rails 6.1 to Rails 7.
While testing it on development env., it works fine.
But I encouter an issue while uploading it on heroku.
Heroku raise this error while precompiling ...
0
votes
0
answers
33
views
Successfully compiled resources are not displayed in the production environment?
After compiling assets in production, old assets are displayed instead of new assets. Moreover, the compilation was successful and the file with the new assets is present on the server. I tried ...
0
votes
2
answers
80
views
Understanding Rails config.assets - when assets are not enabled
Hopefully this is a really simple question for someone…
If…
rails.config.assets.enabled = false
…does that mean that rails will ignore any other configuration settings for config.assets?
For example,
...
1
vote
1
answer
823
views
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 ...
2
votes
1
answer
224
views
Rails app doesn't load updates to Javascript files until I run rails assets:precompile
I have an old Rails app that I'm trying to upgrade to Rails 7. Somewhere in the upgrade process I broke the asset pipeline. When I make updates to a javascript file, the changes aren't visible unless ...
0
votes
0
answers
82
views
Rails JS assets not present in production (Heroku)
Building a Rails 7 app, which works fine in development. When uploading to Heroku, JS doesn't work and no JS is in the asset folder and I get the following errors. CSS works fine:
2022-12-31T09:21:44....
0
votes
0
answers
44
views
Looking for file in javascripts folder but now is javascript folder in Rails 7 jsbundling-rails
I'm getting the error GET http://localhost:3000/javascripts/olLocationMap.js net::ERR_ABORTED 404 (Not Found)
The file is in javascript and does load however.
What is telling Rails to look in /...
0
votes
1
answer
220
views
Use grails-asset-pipeline to compile bootstrap 5 from source
I'm trying to figure out how to compile the latest bootstrap (v5.0.2) from source so I can more easily customize the theme using SASS variables for a grail (v5.2.3) app using the grails asset-pipeline....
2
votes
1
answer
953
views
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 ...
0
votes
0
answers
488
views
CircleCI + Rails 7 + Yarn + assets:precompile - `yarn: not found`
I am using Circle CI to run RSpec tests on a Rails project. I'm new to CircleCI, so I'm piecing together a build script from examples.
My tests are failing because application.css is not in the asset ...
2
votes
1
answer
467
views
Rails 7 sharing stimulus controller functions
I'm trying to share stimulus controller functions with other controllers but the files are not being found because of the asset pipeline digest.
Parent (app/javascript/controllers/a_shared_controller....
0
votes
0
answers
94
views
Rails app/javascript/packs/index.json doesn't exist
<%= javascript_include_tag 'ol_snippet_draw', 'data-turbolinks-track': 'reload' %> results in
ERROR in ./app/javascript/application.js 13:0-16
Module not found: Error: Can't resolve './packs' ...
0
votes
0
answers
1k
views
ActionView::Template::Error ( The asset "application.css" is not present in the asset pipeline. ) in Rails 7
After shifting from webpacker to importmaps in Rails 7. I keep getting this error no matter what I do to resolve it. Following is the output of the error.
I, [2022-12-02T11:33:16.828698 #2401] INFO --...
1
vote
1
answer
529
views
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
0
answers
164
views
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:
<img src={`zone_icons/${zone}.png` }/>
I've seen that in the source code of cssbundling-rails ...
2
votes
1
answer
1k
views
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 ...
0
votes
1
answer
68
views
Rails Asset Pipeline CSS different on remote than in development
I'm having a small issue where my compiled CSS on my deployed app is ever so slightly different to the compiled CSS locally in Development. Thankfully it's causing one minor problem.
I'm using ...
0
votes
1
answer
240
views
Rails 7 sprockets-rails, not regenerating application.css
Edit: Is ./app/assets/builds/application.css a product of yarn? Because if it is then I need to rethink this question. I'm looking into it.
In upgrading from Rails 6 to 7 and going with
gem "...
1
vote
0
answers
67
views
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 ...
3
votes
0
answers
457
views
In Rails 7 with esbuild build, how do I run a script of esbuild fails?
I have this script that runs when running Rails 7 with esbuild build, this is inside package.json in the scripts attribute, it's ran from the Rails procfile:
esbuild app/javascript/*.* --bundle --...
1
vote
1
answer
124
views
"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 ...
0
votes
1
answer
152
views
When I run migration, config.assets is not working in rails 7
I recently upgraded my application from rails 6.1 to rails 7.0.3 and I am facing some issues after that.
Following lines are defined in my development.rb file:
config.assets.debug = true
config.assets....
1
vote
0
answers
111
views
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 ...
1
vote
1
answer
1k
views
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/...
0
votes
1
answer
144
views
Can't play .wav file in Rails web app: RoutingError/404
I'm trying to play a WAV file from my assets folder but I keep getting errors. The audio tag looks like this:
<audio src="<%= asset_path('/audios/opening.wav') %>">
Browser not ...
1
vote
1
answer
121
views
Why Image_tag produces "images/..." instead of "assets/...."?
Rails version: 5.2.4
Ruby version 2.6.10
Per "image_tag" documentation, it should produce image tag with url: "/assets/...", but when I try in rails console, it produces the url &...
0
votes
1
answer
858
views
Error in Rails 7 dynamic loading of javascript file
I am updating a Rails template to v.7 and I'm running into a challenge with updating the dynamic calls to load various Javascript and stylesheets based on the controller/action.
<%= ...
0
votes
1
answer
192
views
Rails 5.2 Asset Pipeline images not loading on heroku
I am working with a Rails 5.2 application
Locally I added a new image to app/assets/images/my-file-name.jpg
and then in my .erb file I reference it using
<%= image_tag "my-file-name.jpg" ...