catalog icon indicating copy to clipboard operation
catalog copied to clipboard

External script is included twice

Open mhlozek opened this issue 7 years ago • 1 comments

I have this minimal setup with standalone build:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>My Catalog</title>
</head>
<body>
    <div id="catalog" />

    <script src="catalog-standalone.min.js"></script>
    <script>
        Catalog.render({
            title: 'Test',
            scripts: ['jquery-3.3.1.min.js'],
            pages: [
                {
                  path: '/',
                  title: 'Introduction',
                  src: 'intro.md'
                }            
			]
        }, document.getElementById('catalog'));
    </script>
</body>
</html>

but when I inspect generated code with dev tools jquery script is included twice. This is generated head section from dev tools:

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test – Introduction</title>
    <style type="text/css" data-emotion="catalog"></style>
    <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
</head>

mhlozek avatar Apr 18 '18 06:04 mhlozek

Thanks, loading and executing scripts/styles something that needs an overhaul.

As a workaround, you can include <script type="text/javascript" src="jquery-3.3.1.min.js"></script> in the index.html template.

Related: #340 #350

jstcki avatar Apr 18 '18 07:04 jstcki