Nodejs + connect-assetmanager + uglifyJs

I'm using nodejs(v0.8.2) with the connect-assetmanager middleware to bundle and minify my js files using uglifyJs(v1.3.2). My configure is like `

var assets = 
    {
    'loginJs':{
        'debug': false,
        'route': /\/js\/login.js/
        , 'path': './public/scripts/'
        , 'dataType': 'javascript'
        , 'files': [
            'configs.js',
            'WMTX.Web.Library.js',
            'sso.js',
            'index.js'
        ]
        ,'postManipulate': {
                 '^': [
                assetHandler.uglifyJsOptimize
            ]
        } 
    },
    assetManager = require('connect-assetmanager'),
    assetsManagerMiddleware = assetManager(assets);
    app.configure(function(){
    app.use("/", assetsManagerMiddleware, express.static(o.paths.root));
});

`

But when I launch the application, an error occured:

at new JS_Parse_Error (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\node_modules\uglify-js\lib\parse-js.js:263:22) at js_error (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\node_modules\uglify-js\lib\parse-js.js:271:15) at parse_error (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\node_modules\uglify-js\lib\parse-js.js:367:17) at Object.next_token [as input] (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\node_modules\uglify-js\lib\parse-js.js:613:17) at next (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\node_modules\uglify-js\lib\parse-js.js:718:37) at Object.parse (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\node_modules\uglify-js\lib\parse-js.js:704:19) at Array.uglifyJsOptimize [as 0] (E:\work\siteexV2\IDE\node_modules\connect-assetmanager-handlers\lib\handlers.js:57:26) at modify (E:\work\siteexV2\IDE\node_modules\connect-assetmanager\lib\assetmanager.js:275:42) at module.exports.manipulate (E:\work\siteexV2\IDE\node_modules\connect-assetmanager\lib\assetmanager.js:281:7) at Function.module.exports.generateCache.settings.forEach.userAgentMatches.forEach.content (E:\work\siteexV2\IDE\node_modules\connect-assetmanager\lib\assetmanager.js:231:11)

I tried minify those js using uglifyJs in command-line, all files can be minified successfully. Please anyone who knows what's going wrong give me some help, this is driving me mad! Thanks so much

I am not familiar with connect-assetmanager, but there are some syntaxerrors in your code.

As far as I understand what you are trying to do, you forgot to end your declaration of "assets" with a semi-colon. You appear to be doing the same thing after calling require(). This is the corrected code:

var assets = 
   {
   'loginJs':{
       'debug': false,
       'route': /\/js\/login.js/,
       'path': './public/scripts/',
       'dataType': 'javascript',
       'files': [
           'configs.js',
           'WMTX.Web.Library.js',
           'sso.js',
           'index.js'
       ],
       'postManipulate': {
           '^': [assetHandler.uglifyJsOptimize]
       }
   }; // <- note the semicolon

assetManager = require('connect-assetmanager'); // <- and here
assetsManagerMiddleware = assetManager(assets);

app.configure(function() {
    app.use("/", assetsManagerMiddleware, express.static(o.paths.root));
});