Search code examples
javascriptcsssvngoogle-code-prettify

Google prettify in an offline / localhost application requesting external files


The google prettify is working great for me. I have built an application with a Twitter bootstrap front-end and the google prettify syntax highlighting. But the application is also used for working offline e.g. localhost, so I included the prettify.js and prettify.css.

Now when I go offline and work in the application, it will start looking for online code through the local prettify.js version:

  • https://google-code-prettify.googlecode.com/svn/loader/lang-"+encodeURIComponent(D[m])+".js

  • https://google-code-prettify.googlecode.com/svn/loader/skins/"+encodeURIComponent(N[m])+".css

  • https://google-code-prettify.googlecode.com/svn/loader/prettify.css

It is working fine offline, but why is it requesting the external js and css files and how can I remove this from the minified prettify.js? I don't need it and it is slowing down the application.


Solution

  • The GettingStarted wiki page explains:

    Serving your own JS & CSS

    You can download the scripts and styles and serve them yourself. Make sure to include both the script and a stylesheet:

    <link href="prettify.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="prettify.js"></script>