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

feat: add support to css url #279

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

EslamHiko
Copy link
Contributor

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

add support for url in css : #259
background: url(image.png) => background-image:url(/webpack/public/path/image.png)

Breaking Changes

No

Additional Info

sources.push({ startIndex, value: urlSource, unquoted });
});
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very bad idea, we should use css-loader for that:

  1. Introduce new attribute type: type: src | srcset | style
  2. Run css-loader for style
  3. Stringify result

Ideally we should have two tests:

  • only css-loader
  • css-loader +postcss-loader, it is allow to autoprefixing in style attribute

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evilebottnawi I couldn't find a way to run css-loader on a string
all I can think about doing is to export style content to temporary file tmp.css and then find a way to run webpack with css-loader on that file, this will make html-loader depend on css-loader and webpack.
Is there a way to run css-loader only on a string ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where we should think. In theory we should create virtual module. Maybe we right now we can use css-loader.call(content), maybe we need more options/API for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need time to think about it.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please avoid prettier changes, we will do it in the other PR

@Pong420
Copy link

Pong420 commented Apr 29, 2021

any update? or some solution for url() in css

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

Successfully merging this pull request may close these issues.

None yet

3 participants