Results 1 to 5 of 5

Thread: How to add script tag in index.html?

  1. #1
    Sencha User
    Join Date
    Dec 2013
    Posts
    3
    Vote Rating
    0
      0  

    Default How to add script tag in index.html?

    Hi,

    I'm using Ext.ux.GMapPanel with ExtJS 4.2.2, project generated with Sencha Cmd v4.0.2.67

    I need to add this tag to index.html header:

    Code:
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=mykey"></script>
    in order to pass my Google maps key to Google.

    How can I do this? I have tried modifying index.html by hand (even if it is not recommended) and obviously it doesn't add the script tag to index.html when I build the app.

    I've also tried to edit app.json but at build time sencha command complains about using mix mode.

    What is the right way to add tags in index.html head?

    Thanks in advance.

    Giorgio

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    505
      0  

    Default

    Are you adding it to the index.html the is under the build DIR as well? (above all-classes.js)

  3. #3
    Sencha User
    Join Date
    Dec 2013
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Hi scottmartin,

    I'm adding it to the index.html located in the top-level folder of my application.

    I guess it is a problem of where to put the line. This is how I've solved the issue.

    Wrong code:

    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>MyApp</title>
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <link rel="stylesheet" href="bootstrap.css">
                <script src="ext/ext-dev.js"></script>
                <script src="bootstrap.js"></script>
                <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=mykey"></script>
            <!-- </x-bootstrap> -->
            <script src="app.js"></script>
        <!-- </x-compile> -->
    </head>
    <body></body>
    </html>
    Correct code:

    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>MyApp</title>
        <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=mykey"></script>
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <link rel="stylesheet" href="bootstrap.css">
                <script src="ext/ext-dev.js"></script>
                <script src="bootstrap.js"></script>
    
            <!-- </x-bootstrap> -->
            <script src="app.js"></script>
        <!-- </x-compile> -->
    </head>
    <body></body>
    </html>
    Positioning the line outside x-compile tags, the build works just fine.

    Is this the correct way of doing the job?

    Thanks,
    Giorgio

  4. #4
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409
    Answers
    716
    Vote Rating
    505
      0  

    Default

    Yes you would place it outside of the directives. This should add it to the index.html build as well.

  5. #5
    Sencha User
    Join Date
    Dec 2013
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •