You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Claude Andrew <cl...@bronzenose.com> on 2014/06/27 06:13:54 UTC

Javascript appears as one long line in client; it's hard to debug.

When I try to debug javascript in a client, the whole script appears as a
single long line; all the whitespace and comments are missing.  I'd like to
see my javascript in all its bulky, multi-line, commented glory - at least
while I'm debugging.  It used to be so but of course I can't figure out
what I did to cause the change.

I had some trouble a while back with yui compressor which was resolved
using advice from the archives (see pom.xml excerpt below) and it might
have been right around then that I broke this - although my attention was
elsewhere.  I am also using JQuery courtesy of org.got5.

It looks as though the (unwanted) work is being done by
AssetsModule.ResourceMinimizer as I get this in the console when I request
the page:

> [INFO] AssetsModule.ResourceMinimizer Minimized context:js/MyTest.js
> (5,068 input bytes of JavaScript to 2,239 output bytes in 543.65 ms, 55.82%
> reduction)


I import my js like this in the component class:

> @Import(library = { "context:/js/MyTest.js" }, stylesheet =
> "context:/css/MyTest.css")
> public class MyTest {
> ...


Here's some configuration I set in app.properties (reported from within the
template) which might be relevant:

   - tapestry.production-mode = false
   - tapestry.compress-whitespace = false
   - tapestry.combine-scripts = false
   - tapestryVersion = 5.3.7
   - tapestry.enable-minification = false

I've tried Chrome's "Empty cache and hard reload" to no avail; same problem
in Firefox / Firebug.

Script in a <script> element in the template is left in tact - comments and
all.

Any help much appreciated.


Claude



yui and JQuery in my pom.xml...

    <dependency>
>       <groupId>org.apache.tapestry</groupId>
>       <artifactId>tapestry-yuicompressor</artifactId>
>       <version>5.3.7</version>
>       <scope>compile</scope>
>       <exclusions>
>         <exclusion>
>           <artifactId>yuicompressor</artifactId>
>           <groupId>com.yahoo.platform.yui</groupId>
>         </exclusion>
>       </exclusions>
>     </dependency>
>     <dependency>
>       <groupId>com.yahoo.platform.yui</groupId>
>       <artifactId>yuicompressor</artifactId>
>       <version>2.4.7</version>
>       <scope>compile</scope>
>       <exclusions>
>         <exclusion>
>           <artifactId>js</artifactId>
>           <groupId>rhino</groupId>
>         </exclusion>
>       </exclusions>
>     </dependency>
> ...
>     <dependency>
>       <groupId>org.got5</groupId>
>       <artifactId>tapestry5-jquery</artifactId>
>       <version>3.0.0</version>
>       <scope>compile</scope>
>     </dependency>

Re: Javascript appears as one long line in client; it's hard to debug.

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 27 Jun 2014 02:01:29 -0300, Claude Andrew <cl...@bronzenose.com>  
wrote:

> d'oh.  I fixed it myself.  It turns out that setting the app.properties
> setting
>
> tapestry.production-mode = false
>>
>
> did not work but the following did:

That's the expected behavior. Symbol values aren't looked up from  
app.properties. That's an internationalization file, not a configuration  
one.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Javascript appears as one long line in client; it's hard to debug.

Posted by Geoff Callender <ge...@gmail.com>.
It's usually better to supply this as a system property (eg. -Dtapestry.production-mode = false) at runtime. For Jetty in Eclipse, put it in VM Arguments, for Tomcat put it in CATALINA_OPTS, for JBOSS put it in JAVA_OPTS, etc.

Geoff

On 27 Jun 2014, at 3:01 pm, Claude Andrew <cl...@bronzenose.com> wrote:

> d'oh.  I fixed it myself.  It turns out that setting the app.properties
> setting
> 
> tapestry.production-mode = false
>> 
> 
> did not work but the following did:
> 
> AppModule.contributeApplicationDefaults(...){
>> configuration.add(SymbolConstants.PRODUCTION_MODE, false);
>> ...
>> }
> 
> 
> I don't know what made me think that app.properties was the right place for
> that but apparently, in this case at least, it was not.
> 
> 
> 
> On Thu, Jun 26, 2014 at 9:13 PM, Claude Andrew <cl...@bronzenose.com>
> wrote:
> 
>> When I try to debug javascript in a client, the whole script appears as a
>> single long line; all the whitespace and comments are missing.  I'd like to
>> see my javascript in all its bulky, multi-line, commented glory - at least
>> while I'm debugging.  It used to be so but of course I can't figure out
>> what I did to cause the change.
>> 
>> I had some trouble a while back with yui compressor which was resolved
>> using advice from the archives (see pom.xml excerpt below) and it might
>> have been right around then that I broke this - although my attention was
>> elsewhere.  I am also using JQuery courtesy of org.got5.
>> 
>> It looks as though the (unwanted) work is being done by
>> AssetsModule.ResourceMinimizer as I get this in the console when I request
>> the page:
>> 
>>> [INFO] AssetsModule.ResourceMinimizer Minimized context:js/MyTest.js
>>> (5,068 input bytes of JavaScript to 2,239 output bytes in 543.65 ms, 55.82%
>>> reduction)
>> 
>> 
>> I import my js like this in the component class:
>> 
>>> @Import(library = { "context:/js/MyTest.js" }, stylesheet =
>>> "context:/css/MyTest.css")
>>> public class MyTest {
>>> ...
>> 
>> 
>> Here's some configuration I set in app.properties (reported from within
>> the template) which might be relevant:
>> 
>>   - tapestry.production-mode = false
>>   - tapestry.compress-whitespace = false
>>   - tapestry.combine-scripts = false
>>   - tapestryVersion = 5.3.7
>>   - tapestry.enable-minification = false
>> 
>> I've tried Chrome's "Empty cache and hard reload" to no avail; same
>> problem in Firefox / Firebug.
>> 
>> Script in a <script> element in the template is left in tact - comments
>> and all.
>> 
>> Any help much appreciated.
>> 
>> 
>> Claude
>> 
>> 
>> 
>> yui and JQuery in my pom.xml...
>> 
>>    <dependency>
>>>      <groupId>org.apache.tapestry</groupId>
>>>      <artifactId>tapestry-yuicompressor</artifactId>
>>>      <version>5.3.7</version>
>>>      <scope>compile</scope>
>>>      <exclusions>
>>>        <exclusion>
>>>          <artifactId>yuicompressor</artifactId>
>>>          <groupId>com.yahoo.platform.yui</groupId>
>>>        </exclusion>
>>>      </exclusions>
>>>    </dependency>
>>>    <dependency>
>>>      <groupId>com.yahoo.platform.yui</groupId>
>>>      <artifactId>yuicompressor</artifactId>
>>>      <version>2.4.7</version>
>>>      <scope>compile</scope>
>>>      <exclusions>
>>>        <exclusion>
>>>          <artifactId>js</artifactId>
>>>          <groupId>rhino</groupId>
>>>        </exclusion>
>>>      </exclusions>
>>>    </dependency>
>>> ...
>>>    <dependency>
>>>      <groupId>org.got5</groupId>
>>>      <artifactId>tapestry5-jquery</artifactId>
>>>      <version>3.0.0</version>
>>>      <scope>compile</scope>
>>>    </dependency>
>> 
>> 
>> 
>> 


Re: Javascript appears as one long line in client; it's hard to debug.

Posted by Claude Andrew <cl...@bronzenose.com>.
d'oh.  I fixed it myself.  It turns out that setting the app.properties
setting

tapestry.production-mode = false
>

did not work but the following did:

AppModule.contributeApplicationDefaults(...){
> configuration.add(SymbolConstants.PRODUCTION_MODE, false);
> ...
> }


I don't know what made me think that app.properties was the right place for
that but apparently, in this case at least, it was not.



On Thu, Jun 26, 2014 at 9:13 PM, Claude Andrew <cl...@bronzenose.com>
wrote:

> When I try to debug javascript in a client, the whole script appears as a
> single long line; all the whitespace and comments are missing.  I'd like to
> see my javascript in all its bulky, multi-line, commented glory - at least
> while I'm debugging.  It used to be so but of course I can't figure out
> what I did to cause the change.
>
> I had some trouble a while back with yui compressor which was resolved
> using advice from the archives (see pom.xml excerpt below) and it might
> have been right around then that I broke this - although my attention was
> elsewhere.  I am also using JQuery courtesy of org.got5.
>
> It looks as though the (unwanted) work is being done by
> AssetsModule.ResourceMinimizer as I get this in the console when I request
> the page:
>
>> [INFO] AssetsModule.ResourceMinimizer Minimized context:js/MyTest.js
>> (5,068 input bytes of JavaScript to 2,239 output bytes in 543.65 ms, 55.82%
>> reduction)
>
>
> I import my js like this in the component class:
>
>> @Import(library = { "context:/js/MyTest.js" }, stylesheet =
>> "context:/css/MyTest.css")
>> public class MyTest {
>> ...
>
>
> Here's some configuration I set in app.properties (reported from within
> the template) which might be relevant:
>
>    - tapestry.production-mode = false
>    - tapestry.compress-whitespace = false
>    - tapestry.combine-scripts = false
>    - tapestryVersion = 5.3.7
>    - tapestry.enable-minification = false
>
> I've tried Chrome's "Empty cache and hard reload" to no avail; same
> problem in Firefox / Firebug.
>
> Script in a <script> element in the template is left in tact - comments
> and all.
>
> Any help much appreciated.
>
>
> Claude
>
>
>
> yui and JQuery in my pom.xml...
>
>     <dependency>
>>       <groupId>org.apache.tapestry</groupId>
>>       <artifactId>tapestry-yuicompressor</artifactId>
>>       <version>5.3.7</version>
>>       <scope>compile</scope>
>>       <exclusions>
>>         <exclusion>
>>           <artifactId>yuicompressor</artifactId>
>>           <groupId>com.yahoo.platform.yui</groupId>
>>         </exclusion>
>>       </exclusions>
>>     </dependency>
>>     <dependency>
>>       <groupId>com.yahoo.platform.yui</groupId>
>>       <artifactId>yuicompressor</artifactId>
>>       <version>2.4.7</version>
>>       <scope>compile</scope>
>>       <exclusions>
>>         <exclusion>
>>           <artifactId>js</artifactId>
>>           <groupId>rhino</groupId>
>>         </exclusion>
>>       </exclusions>
>>     </dependency>
>> ...
>>     <dependency>
>>       <groupId>org.got5</groupId>
>>       <artifactId>tapestry5-jquery</artifactId>
>>       <version>3.0.0</version>
>>       <scope>compile</scope>
>>     </dependency>
>
>
>
>