Skip to content

Replace link tags with style #1

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

Merged
merged 1 commit into from
Sep 20, 2018
Merged

Replace link tags with style #1

merged 1 commit into from
Sep 20, 2018

Conversation

rojoca
Copy link
Owner

@rojoca rojoca commented Sep 20, 2018

Currently this plugin removes the <link> tag then appends the inlined styles to the end of <head>. Since css precedence matters, we want to ensure the order of included CSS is the same. By replacing the <link> in place with the inlined styles this can be achieved.

For example, given:

<head>
    <!-- ... -->
    <link href="first.css">
    <link href="second.css">
    <link href="third.css">
</head>

If we only want to inline second.css, currently the plugin will result in:

<head>
    <!-- ... -->
    <link href="first.css">
    <link href="third.css">
    <style>/* inlined second.css */</style>
</head>

But with this change will be as expected:

<head>
    <!-- ... -->
    <link href="first.css">
    <style>/* inlined second.css */</style>
    <link href="third.css">
</head>

@rojoca rojoca merged commit 5b8f9b0 into master Sep 20, 2018
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.

1 participant