Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6830995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:05+00:00 2026-05-26T22:41:05+00:00

goog.string is not able to be used when soyutils.js is included in the same

  • 0

goog.string is not able to be used when soyutils.js is included in the same HTML file.

because in soyutils.js has its own goog.string that completely override goog.string <– goog.require(‘goog.string’).


<!DOCTYPE html>
<html>
<head>
    <title>codeBox</title>
    <script src="{{STATIC_URL}}closure-library/closure/goog/base.js"></script>
    <script>

    goog.require('goog.string');

    </script>

    <script src="{{STATIC_URL}}soyutils.js"></script>
</head>
<body>
    <script>
    console.log(goog.string.trim);

    </script>
</body>

(ignore {{STATIC_URL}} that is for Django Server)

console.log(goog.string.trim) will show you “undefined”.

That’s becuase goog.string is overridden by goog.string located in soyutils.js.

how can i get around this problem without compiling ? (when I compile all the files .. then it runs well)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:41:06+00:00Added an answer on May 26, 2026 at 10:41 pm

    Instead of

    <script src="{{STATIC_URL}}soyutils.js"></script>
    

    use

    <script src="{{STATIC_URL}}soyutils_usegoog.js"></script>
    

    You can find soyutils_usegoog.js in the same directory as soyutils.js in the closure templates tarball.

    The problem arises because there are two versions of soyutils.

    1. soyutils.js is the version for non-closure users and includes just enough closure to make the JavaScript from SoyToJSCompiler work.
    2. soyutils_usegoog.js is the version that works with the closure library and closure compiler. It should not conflict with closure library.

    Closure Template JavaScript Usage explains:

    JavaScript code that’s generated by the template compiler depends on a number of utilities.

    Include one of these two utility files, depending on whether you’re already using the Closure Library:

    • javascript/soyutils.js
    • javascript/soyutils_usegoog.js

    These files are included in the tarball you can download from the Closure Templates downloads page.

    If your project already uses the Closure Library, use soyutils_usegoog.js, which is a much smaller file than soyutils.js.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cell that has string IDs. I need to replace them with
At the http://goog-perftools.sourceforge.net/doc/tcmalloc.html it is stated: CMalloc currently does not return any memory to
I've Goog'd but I can't find any third party library that will let you
What most people mean by autocomplete is that the app has a textview/searchbar/whatever which
I want to make an NSDictionary that has the following values where symbol &
I have some html code like this. <a href=http://www.google.com.pk id=goog title=<table width='20%' border='1'> <tr>
I'm trying to find a tool that generates HTML documentation for my Javascript source
I was trying to parse the string: Portfolio1[{Exchange:NASDAQ-Symbol:INFY-Full Name:Infosys Technologies Limited (ADR)-Share Count:100.0-Percent Gain:388.2258065-The
I have a remote database (at the moment sqlite, but eventually mysql) that I
First, apologies for asking something that must be answered here somewhere (I've been looking!)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.