Skip to content
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

asset_url helpers don't work #18

Closed
ssalzberg opened this issue Apr 13, 2022 · 2 comments
Closed

asset_url helpers don't work #18

ssalzberg opened this issue Apr 13, 2022 · 2 comments

Comments

@ssalzberg
Copy link

ssalzberg commented Apr 13, 2022

In switching over from sass-rails to dartsass-rails, I noticed the asset path helpers no longer work. In development mode, something like this works fine:

div {
    background-image: url("path/in/assets/to/image.jpg");
}

but in production, neither that nor this works:

div {
    background-image: asset-url("path/in/assets/to/image.jpg");
}
@ntkme
Copy link
Contributor

ntkme commented Apr 15, 2022

dartsass-rails cannot pass ruby functions to the dart sass compiler, so that it does not support asset helpers.

If you need the asset-url helper, you can try sassc-embedded and configure your rails app as if it is using sassc. It is based on dart-sass-embedded and provides a ruby API that is compatible with SassC so that sprockets would work as is.

@dhh
Copy link
Member

dhh commented Apr 30, 2022

Latest Sprockets and Propshaft will both replace url() to an digest-stamped version.

@dhh dhh closed this as completed Apr 30, 2022
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 9, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 9, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 9, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 9, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 10, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 10, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 10, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 10, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 11, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Oct 11, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 1, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 1, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 1, 2023
Also, replace `image-url` helper instances with CSS url() function
See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/frontend that referenced this issue Nov 6, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/collections that referenced this issue Nov 6, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 6, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.
jon-kirwan pushed a commit to alphagov/static that referenced this issue Nov 8, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 20, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 20, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/frontend that referenced this issue Nov 20, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 22, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/collections that referenced this issue Nov 22, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/static that referenced this issue Nov 23, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/static that referenced this issue Nov 24, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/static that referenced this issue Nov 28, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 29, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/static that referenced this issue Nov 29, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Nov 30, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Dec 4, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Dec 4, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Dec 4, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/frontend that referenced this issue Dec 11, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/frontend that referenced this issue Dec 11, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Dec 11, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/frontend that referenced this issue Dec 11, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/static that referenced this issue Dec 11, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/static that referenced this issue Dec 11, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/govuk_publishing_components that referenced this issue Dec 12, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
Also, add asset handlers to ensure fonts and images are correctly referenced. See https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#copy-the-font-and-image-files-into-your-application.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/collections that referenced this issue Dec 18, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/static that referenced this issue Dec 18, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/static that referenced this issue Dec 19, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/collections that referenced this issue Dec 20, 2023
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/collections that referenced this issue Jan 3, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/collections that referenced this issue Jan 3, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/frontend that referenced this issue Jan 3, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/frontend that referenced this issue Jan 4, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/collections that referenced this issue Jan 12, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/frontend that referenced this issue Jan 12, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jon-kirwan added a commit to alphagov/collections that referenced this issue Jan 16, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.
jon-kirwan added a commit to alphagov/frontend that referenced this issue Jan 17, 2024
Replace instances with CSS url() function. See rails/dartsass-rails#18.

Co-Authored-By: Martin Jones <[email protected]>
jacob-carlborg-apoex added a commit to jacob-carlborg-apoex/rails_admin that referenced this issue Sep 9, 2024
Both Sprockets and Propshaft will replace `url` with a digested
version [1]. This change allows to use these Sass files with other
Sass implementations like, Dartsass [2].

[1] rails/dartsass-rails#18 (comment)
[2] https://github.com/rails/dartsass-rails
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

3 participants