librelist archives

« back to archive

arguments to flask assets

arguments to flask assets

From:
Matthew Hoopes
Date:
2012-12-12 @ 00:50
Hi,

I'm trying to find a way to pass arguments to flask assets. Specifically, I
want to send uglifyjs the -cm flags, and I've read the docs, but I can't
seem to find the place in flask (or the flask assets environment) to set
the UGLIFYJS_EXTRA_ARGS to get it to compress and mangle.

Can anyone show me an example I can follow? Googling and searching github
didn't turn up anything clear-cut, and I'm obviously being slow.

Thanks very much in advance!

- matt

Re: [flask] arguments to flask assets

From:
Audrius Kažukauskas
Date:
2012-12-12 @ 21:17
On Tue, 2012-12-11 at 19:50:11 -0500, Matthew Hoopes wrote:
> I'm trying to find a way to pass arguments to flask assets. Specifically, I
> want to send uglifyjs the -cm flags, and I've read the docs, but I can't
> seem to find the place in flask (or the flask assets environment) to set
> the UGLIFYJS_EXTRA_ARGS to get it to compress and mangle.

This should work:

  assets = Environment(app)
  # 'uglifyjs_extra_args' requires 'uglifyjs_bin' to be provided as
  # well, otherwise it fails with KeyError exception.
  assets.config['uglifyjs_bin'] = 'uglifyjs'
  assets.config['uglifyjs_extra_args'] = ['-c', '-m']

-- 
Audrius Kažukauskas
http://neutrino.lt/