brunch / terser-brunch

A javascript minifier for brunch files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong minified output with a jade template

chrismcv opened this issue · comments

Hi,
I've run into an issue where my templates.js has bad syntax when i use brunch b -m.

I have a file called templates.js which is my generated jade templates, and if I call uglify on this, it minifies fine (with the default settings)...

Is brunch doing something different that would cause this behavior to be different?

The un-compressed templates file is here: https://dl.dropbox.com/u/120257/templates.js

Cheers,
Chris

as you can see in the source code, it does the recommended in readme stuff. maybe command line uglify does something else than gen_code ast_squeeze ast_mangle parse data. Maybe @mishoo could help us?

Ah, I got it. The public API is actually uglify(). What happens if you do minified = uglify data?

hey, changing to uglify does the same thing, however, i think there must we something else going on....

my config has the following:

    templates:
      defaultExtension: 'jade'
      joinTo: 'javascripts/templates.js'

and no other reference to the template.js file....

i also have app.js and vendor.js....

when I run brunch b -m with a console.log('uglify') above uglify(data) it only fires twice, (for vendor and app), so I think the templates.js must be getting broken elsewhere? is that possible?

(also, on a maybe unrelated note, "minify:true" in config.coffee seems to have no effect - I have to minify via command line

If I minify that template from the command line using uglifyjs, the output seems fine (that is, it's syntactically valid). I don't know anything about “brunch”, but it's probably not an UglifyJS issue.

Sounds strange, I think you will need to debug the brunch itself. You can start at src/fs_utils/generted_file.coffee (line 82).

BRUNCH_DEBUG=1 brunch build -o build
This isn't outputting any debug info on ubuntu/windows for me? is there
another trick to get the logger.debug line out?

On Fri, Sep 7, 2012 at 4:25 PM, Paul Miller notifications@github.comwrote:

Sounds strange, I think you will need to debug the brunch itself. You can
start at src/fs_utils/generted_file.coffee (line 82).


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-8368574.

Actually minifier does not seem to have any loggings. You could try to add console.log-s there by yourself

The latest commit seem to fix the issue.

Specify this in your brunch config:

config: {
  plugins: {
    uglify: {mangle_options: {mangle: false}}
  }
}

and try the stuff.