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

Script tags added after body close tag when autorequiring #14

Open
iguatemigarin opened this issue Oct 13, 2017 · 0 comments
Open

Script tags added after body close tag when autorequiring #14

iguatemigarin opened this issue Oct 13, 2017 · 0 comments

Comments

@iguatemigarin
Copy link

iguatemigarin commented Oct 13, 2017

Before compilation

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="styles/reset.css">
    <link rel="stylesheet" href="styles/app.css">
    <link rel="stylesheet" href="fonts/font.css">
</head>
<body>
    <div id="app-root"></div>
    <script src="javascripts/vendor.js"></script>
    <script src="javascripts/app.js"></script>
</body>
</html>

After compilation

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="styles/reset.css">
    <link rel="stylesheet" href="styles/app.css">
    <link rel="stylesheet" href="fonts/font.css">
</head>
<body>
    <div id="app-root"></div>
    <script src="javascripts/vendor.js"></script>
    <script src="javascripts/app.js"></script>
</body>
<script src="/sw-precache.js"></script>
<script>if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw-precache.js')</script>
</html>

Expected result

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="styles/reset.css">
    <link rel="stylesheet" href="styles/app.css">
    <link rel="stylesheet" href="fonts/font.css">
</head>
<body>
    <div id="app-root"></div>
    <script src="javascripts/vendor.js"></script>
    <script src="javascripts/app.js"></script>
<script src="/sw-precache.js"></script>
<script>if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw-precache.js')</script>
</body>
</html>

$('html').append(swSource, registrationScript);

I suggest changing the selector to the body tag instead of the html tag.

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

1 participant