Questions tagged [sprockets]

Sprockets is a Ruby library that preprocesses and concatenates JavaScript and CSS source files.

Filter by
Sorted by
Tagged with
1 vote
0 answers
18 views

js.erb files with esbuild in Rails 7

I would like to package a js.erb file with esbuild. In my app, a user clicks on a 'Buy' button, which is connected to a Stimulus controller. The Stimulus action redirects to Stripe, but needs a public ...
  • 81
-1 votes
1 answer
45 views

Getting error while running the rails server in sprockets [closed]

I try to update my rails application after runned the rails app:update command i try to run rails s but in that time, i faced some issues like SassC::SyntaxError - Error: File to import not found or ...
2 votes
1 answer
71 views

Sprockets processing image assets from a gem

I'm migrating from sprockets 3 to sprockets 4 and v4 seems to ignore assets from gems. Those were automatically handled by v3, but I can't seem to find anything about porting this behaviour. For ...
  • 33k
0 votes
0 answers
55 views

Sprockets::FileNotFound: couldn't find file 'tipso/src/tipso' with type 'application/javascript'

I am trying to deploy my app to Heroku and I keep getting stuck on this Sprockets error that a file cannot be found. I don't understand why this is occurring. # assets.rb Rails.application.config....
1 vote
1 answer
299 views

New Rails 7 app with Sprockets can't find application.js file (Circle CI)

has anyone noticed that new Rails apps seem to fail on circleCI with this error: Sprockets::Rails::Helper::AssetNotFound in Home#index The asset "application.js" is not present in the asset ...
  • 4,149
0 votes
1 answer
123 views

How do I keep Rails in development mode from concatenating stylesheets and javascripts?

I am using Rails 6.1 in development mode: root@19ababcf7904:/app# bin/rails s -b 0.0.0.0 -p 3001 => Booting Puma => Rails 6.1.7 application starting in development => Run `bin/rails server --...
0 votes
1 answer
384 views

Rails 7 without Sprockets and with Propshaft brought error and cannot be deployed

I tried to deploy the Rails 7 application without Sprockets and with Propshaft and got this error. Gemfile do not contain both gems sprockets and sprockets-rails. rake asset:precompile works. Build ...
1 vote
1 answer
152 views

Sprockets 4 and possibility to pass stylesheets folder handling to dart sass

Is there anything in Sprockets 4 to use like Propshaft has? config.assets.excluded_paths You can however exempt directories that have been added through the config.assets.excluded_paths. This is ...
  • 625
1 vote
1 answer
1k views

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

Rails version: 7.0.3.1 Ruby version: 3.1.0p0 React version: 18.2.0 I'm trying to add React to my existing rails app and followed the tutorial here - https://medium.com/rd-shipit/how-to-set-up-a-rails-...
  • 134
1 vote
3 answers
3k views

LoadError: cannot load such file -- sassc

running rake assets:precompile ends with the error. Can't find why it still requires sassc, sassc only was in project when migrated to sprockets 4 using Guide to upgrading from Sprockets 3.x to 4.x: ...
  • 625
0 votes
1 answer
405 views

Rails asset pipeline not automatically compiling with esbuild only on WSL

I have a rails 6 app using esbuild to bundle all my js files to app/assets/build. I have to manually run rails assets:precompile in order for the changes that are in app/assets/build to actually be ...
0 votes
1 answer
121 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" ...
0 votes
0 answers
62 views

Sprockets::Rails::Helper::AssetNotPrecompiled error until '/' is added to image_tag routes

I have lots of image_tag in html.erb files. On running the server, I came across the Sprockets::Rails::Helper::AssetNotPrecompiled error for every image_tag. I was able to fix that error by adding / ...
0 votes
1 answer
139 views

how install Svelte framewoek with Rails 6+ and Sprocket (no webpack)

I have a Rails 6 app and I want use Svelte on client side only I have nodeJS, NPM and Yarn installed. Now, how can I install Svelte to this app without webpack, only using sprocket ?
  • 3,398
8 votes
1 answer
1k views

Sprockets //= require with jsbundling-rails (esbuild) - how to include JS provided by gem?

Basically, exactly as the title says. I have a gem installed that gives me some JS to use. This wasn't a problem before as I was using Sprockets + Assets pipeline. Now, I migrated to jsbundling-rails ...
  • 151
0 votes
0 answers
84 views

Sprockets cannot precompile chartkick

I am using chartkick (added gem 'chartkick' in my Gemfile) and have defined it in my views/layouts/application.html.erb like this: <%= javascript_include_tag "//www.google.com/jsapi", &...
0 votes
0 answers
266 views

Tailwind + SASSC in conjunction with Sprockets

I am having issues with Tailwind. Seems like Tailwind is not compatible with SASSC as it probably uses newer CSS. https://github.com/rails/cssbundling-rails#how-do-i-avoid-sasscsyntaxerror-exceptions-...
  • 1,879
0 votes
0 answers
27 views

couldn't find file 'owl.theme.default' with type 'text/css' error in rails 5.1.4

im getting the below error. Sprockets::FileNotFound at / couldn't find file 'owl.theme.default' with type 'text/css' Checked in these paths: /home/xyz/abc/proj1/app/assets/config /home/xyz/abc/...
  • 1,264
0 votes
2 answers
995 views

rails 7 with sprockets, enable origin file in compiled css in development

I just started a new rails 7 project with --css bootstrap, but I'm finding that starting the server with bin/dev the compiled css does no longer (as in previous rails versions) output a comment with ...
  • 2,746
1 vote
1 answer
91 views

What is "//= require" in a JavaScript file in a Rails app?

I'm looking at the source code of a Ruby on Rails app. Several of the JavaScript (*.js and *.es6) files in the source have one or more lines at the top of the file like: //= require path/to/...
0 votes
1 answer
645 views

Bug on url() in scss files on rails 7

I'm having troubles with the url() css function in my rails 7 project. I reproduced it on a brand new one: https://github.com/paul-mesnilgrente/rails-7-url, see this commit: https://github.com/paul-...
  • 616
4 votes
4 answers
5k views

Application.js not compiling after upgrading to Rails 7 on heroku with esbuild

I updated my app on Heroku from Rails 6 with Webpacker to Rails 7 with esbuild. The error I receive on production is as follows: The asset "application.js" is not present in the asset ...
  • 121
1 vote
0 answers
279 views

Uncaught ReferenceError: exports is not defined react-rails

I need to add react-rails to my rails 4 app, but it's giving me hard time to figure out. my project uses sprockets for assets:precompilation, this is my component: import React from "react" ...
  • 2,746
0 votes
1 answer
335 views

Uncaught ReferenceError: require is not defined react-rails

I'm trying to integrate react-rails 2.6.1 within my rails 4.2.11 app. initially started with webpacker but it's giving me troubles with the actual prod deployment, so I removed webpacker and just pack ...
  • 2,746
2 votes
0 answers
190 views

Using Manifest.js & config.assets.precompile in rails

I was trying to understand the difference between these two things, manifest.js and config.assets.precompile in application.rb When we want to use some specific CSS or js for a page, we usually add ...
  • 621
2 votes
1 answer
2k views

Sprockets is not picking up app/assets/builds folder Rails 7

I just set an empty Rails 7.0.1 project and add Docker file to it, when the command rake assets:precompile run it's not including the files inside the app/assets/builds folder. Does anyone have an ...
  • 423
0 votes
0 answers
62 views

Rails <script> tag in <head> having random string in "type" attribute and therefore not loading JS

In my Ruby on Rails website, script tags in head get assigned random string in type attribute. It only happens on a single page though. All other pages are fine and the correct type="text/...
  • 151
1 vote
1 answer
163 views

Ruby Sprockets v4.0 upgrade FileNotFound (assets extension mismatch .coffee, .scss - mime types?)

I recently updated my app to use Sprockets 4.0: https://www.rubydoc.info/gems/sprockets/4.0.0 I introduced the manifest.js file as described here: https://github.com/rails/sprockets/blob/master/...
1 vote
1 answer
388 views

How do I register a compressor with sprockets on the command line?

I want to use Sprockets at the command line (with the ruby-sprockets Debian package), and I want to use Terser as the JavaScript compressor (because Uglify doesn't support ES6). All the documentation ...
2 votes
2 answers
631 views

Reference existing scss assets after installing `cssbundling-rails` on existing rails project

After installing the cssbundling-rails gem I'm having trouble referencing my existing .scss files that live under app/assets/stylesheets/. When you install the cssbundling-rails gem it: removes your ...
1 vote
1 answer
325 views

How Sprocket's require works?

I have a file called application.js under app/assets/javascripts // = require libs/jquery-retina // = require libs/jquery.popupoverlay // = require libs/messg // = require site_logic/application // = ...
6 votes
2 answers
931 views

tailwindcss typography "SassC::SyntaxError: Error: unterminated attribute selector for type"

I upgraded the tailwindcss-rails gem and got this error when compiling assets for production: bundle exec rails assets:precompile rails aborted! SassC::SyntaxError: Error: unterminated attribute ...
  • 6,974
0 votes
0 answers
96 views

Several views in my Ruby on Rails app requires me to refresh the page before it works properly, a search and the Google Maps especially

I converted a program called CtrlPanel from Ruby v2.2.2 & Rails v4.2.1 to Ruby 2.7.3 & Rails 6.1.3.2 and I have it working pretty well now for the most part (was NOT an easy process for me at ...
2 votes
2 answers
2k views

Struggling with asset pipeline: The asset "{name}" is not present in the asset pipeline

As part of ongoing efforts to migrate a legacy app from Rails 3 to Rails 6, I'm trying to figure out the best way to move forward with assets and whatnot. I'm struggling with the following issue, when ...
  • 2,032
0 votes
1 answer
274 views

Rails 6 app ignores custom CSS file. How do I add it?

I am trying to add a custom CSS file to an existing Rails 6 app. The app has installed (among other) these gems (Gemfile): gem 'webpacker' gem 'jquery-rails' gem 'jquery-turbolinks' gem 'jquery-ui-...
  • 45.6k
1 vote
2 answers
859 views

Sprockets::FileNotFound: couldn't find file 'jquery-ui' with type 'text/scss' when deploying a Rails 6 app to Heroku

I am struggling to deploy my Rails 6 app to Heroku - the deployment breaks with this error message: remote: rake aborted! remote: Sprockets::FileNotFound: couldn't find file 'jquery-ui' ...
  • 45.6k
0 votes
1 answer
520 views

Rails 5 assets not mentioned on the `applications.js` manifest are served?

Please enlighten me! Let say I have the following assets structure in a Rails 5 application. app/assets/javascripts application.js file1.js In the application.js manifest I am not requiring //= ...
2 votes
2 answers
358 views

Sprockets::Rails::Helper::AssetNotPrecompiled in ResqueWeb

I've been trying to fix this for about two days but I'm getting no where. I'm trying to get the resque-web page to show but I keep running into the error Sprockets::Rails::Helper::AssetNotPrecompiled ...
3 votes
1 answer
427 views

"Error: Undefined variable" in Rails sass compilation

I am building a rails app and having some odd sass compilation issues. My setup: Rails 6.1.3 Ruby 3.0.0 sass-rails 6.0.0 sassc-rails 2.1.2 My application.scss basically loads a few sass files that ...
  • 1,722
0 votes
1 answer
586 views

Rails - sprockets cannot recognize scss files

I recently upgraded my Sprockets from 3.7.2 to 4.0.2 and since then my application.css file cannot recognize one of the files that has been written in scss: *= require editor/content-tools.scss *=/ ...
1 vote
1 answer
145 views

Disable loading all stylesheets in rails6 development

I want to load/unload the specific css debugging bulma structures by comment/uncomment the line of stylesheet_link_tag: # app/view/layouts/application.html.erb ... <%= stylesheet_link_tag '...
  • 429
1 vote
1 answer
851 views

cause of excessively large application.js file in public/packs for rails app? / rack timeout error

My app has been throwing frequent rack timeout errors, and i think i narrowed the problem down to the size of the compiled javascript file. public/packs/application-5db30a18f8715133f889.js is 2.1mb. ...
  • 1,308
0 votes
1 answer
154 views

cause of Less::Error `unmatched '/*'`/ Sass::SyntaxError in my rails app

I just switched from Semantic UI to the community maintained Fomantic UI in my Rails app, and get one of two obscure errors when using either the npm package or the sass rails gem. With the npm ...
  • 1,308
0 votes
1 answer
75 views

Rails 4 compiling vendor assets but not application.js and application.css

I have an old Rails 3 app I'm upgrading to Rails 4. Sprockets seems to be adding suffixes and working with the Javascript I have in /vendor, but my assets/javascripts/application.js, assets/...
  • 12.5k
5 votes
1 answer
2k views

Rails 6 not recompiling SCSS using Sprocket / Assets in development

I have a Rails 6 app I return to sporadically. It's using webpacker for the JS, and Sprockets for the CSS (as I think is default). If relevant, I'm developing on WSL - the files are in the Ubuntu ...
  • 45.6k
1 vote
1 answer
196 views

Sprockets throws NoMethodError while pushing to Heroku

I am upgrading my app to ruby 2.6.5 and it seems sprockets 4.0.2 is the cause of the issue. Most answers I've found involve downgrading to sprockets 3.7.2 (which I'm using locally), but when the ...
2 votes
1 answer
420 views

How to use stylesheet_link_tag with sprockets 4?

I have file app/assets/stylesheets/themes/plexa/home.sass Added to config/manifest.js //= link themes/plexa/home.css Check http://localhost:3000/assets/themes/plexa/home.css - It works, I see css! ...
2 votes
1 answer
1k views

How do I tell Sprockets 4 to compile assets for a vendored gem?

We have a Rails 5 application and recently updated Sprockets from the 3.x series to 4.0.2. Now Rails can't find an asset (CSS file) belonging to a vendored gem. Note that the gem is an engine and the ...
  • 9,164
0 votes
1 answer
312 views

Error Errno::EEXIST occurs when loading page in Rails app using WSL

I'm running a Rails app using Docker on Windows with WSL 1. Sometimes after cleaning up among Docker volumes, I get this error after restarting the app. The error message is "File exists @ ...
  • 326
0 votes
0 answers
3k views

await is not defined (jQuery + CoffeeScript)

versions jQuery 2.2.4 CoffeeScript 2.4.1 Rails 5.1.7 Sprockets 4.0.0 error sample.source.coffee:33 Uncaught ReferenceError: await is not defined at countdown (sample.source.coffee:...

1
2 3 4 5
17