Skip to content

CSS Bundling, Rails 7 and Bootstrap #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
resistorsoftware opened this issue Sep 7, 2022 · 3 comments
Closed

CSS Bundling, Rails 7 and Bootstrap #102

resistorsoftware opened this issue Sep 7, 2022 · 3 comments

Comments

@resistorsoftware
Copy link

New Rails 7 App with ESBuild, and Bootstrap. It works. OK. Great. Builds fine.

In the provided app/assets/stylesheets/application.bootstrap.scss file, if I were to add a single class of valid code to use an image, it all breaks. For example:

.test {
   background-image: image-url("foo.jpg");
}

For whatever reason, when the sass command tries to build that, the build blows up with errors. Specifically, the long-ass fingerprint signature added to the asset is part of the error. Not sure why. It seems the helpers for sass are not being digested properly as per the old sassc-rails gem. So what is the modern way to go here?

What is the secret to using the needed helpers to get assets into Sass with the new setup and CSS Bundling gem?

@PedroAugustoRamalhoDuarte

@resistorsoftware i thinks is the same problem with this issue: #22

@jasonfb
Copy link

jasonfb commented Dec 5, 2022

@resistorsoftware did you try

.test {
   background-image: url("foo.jpg");
}

I think this got added to Sprockets here: https://github.com/rails/sprockets-rails/pull/476/files

@jasonfb
Copy link

jasonfb commented Dec 5, 2022

https://github.com/rails/sprockets-rails#initializer-options

config.assets.resolve_assets_in_css_urls

When this option is enabled, sprockets-rails will register a CSS postprocessor to resolve assets referenced in [url()](https://developer.mozilla.org/en-US/docs/Web/CSS/url()) function calls and replace them with the digested paths. Defaults to true.

@dhh dhh closed this as completed Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants