def build(): """Builds all bundles. Builds bundles, regardless of whether they are changed or not. """ script.main(['build'], webassets_tools.env) click.secho(u'Compile assets: SUCCESS', fg=u'green', bold=True)
def clean(): u'''Will clear out the cache, which after a while can grow quite large.''' try: script.main(['clean'], webassets_tools.env) except BundleError as e: return error_shout(e) click.secho(u'Clear cache: SUCCESS', fg=u'green', bold=True)
def watch(): u'''Start a daemon which monitors source files, and rebuilds bundles. This can be useful during development, if building is not instantaneous, and you are losing valuable time waiting for the build to finish while trying to access your site. ''' script.main(['watch'], webassets_tools.env)
def test_script(): """Test simply that the main script can be invoked.""" main([])
def main(): script.main(sys.argv[1:], env=assets_env)
def test_script(): main([])
def build(): u'''Builds bundles, regardless of whether they are changed or not.''' script.main(['build'], webassets_tools.env) click.secho(u'Compile assets: SUCCESS', fg=u'green', bold=True)
def assets_rebuild(): from webassets import script env = app.jinja_env.assets_environment script.main(('build', '--no-cache'), env=env)
'styles/normalize.css', 'styles/font-awesome.css', 'styles/main.css', 'styles/type.css', 'styles/responsive.css', 'styles/pygments.css', 'styles/magnific-popup.css', 'styles/print.css', filters='less,cssmin', output='styles/styles.min.css' ) assets_env.register( 'js_main', 'scripts/jquery.js', 'scripts/lodash.js', 'scripts/doctools.js', 'scripts/magnific-popup.js', 'scripts/main.js', filters='closure_js', output='scripts/scripts.min.js' ) if __name__ == '__main__': import sys from webassets import script script.main(sys.argv[1:], env=assets_env)
parser.add_option('--debug-assets', dest='_debug_assets', action='store_true', help='debug asset bundling') parser.add_option('--build-assets', dest='_build_assets', action="store_true", help='bundle assets') (opts, args) = parser.parse_args() # Load config file if specified if opts.config is not None: app.config.from_pyfile(opts.config) # Overwrite only those settings specified on the command line for k in dir(opts): if not k.startswith('_') and getattr(opts, k) is None: delattr(opts, k) app.config.from_object(opts) if opts._debug_assets: app.config['DEBUG'] = True app.config['ASSETS_DEBUG'] = False else: app.config['ASSETS_DEBUG'] = app.config['DEBUG'] if opts._build_assets: from webassets import script script.main(['build', '--production'], env=assets) else: app.run(host=opts.host, port=opts.port, threaded=True)
def main(): script.main(sys.argv[1:], env=env)
def run(self, *args): from webassets import script app = create_app() script.main(args, env=app.assets)
def run(self, *args): from webassets import script script.main(args, env=app.assets)
parser.add_option('-w', '--websocket', metavar='BASE-URL', dest='WEBSOCKET_BASEURL', help='base URL for websocket server') parser.add_option('--debug-assets', dest='_debug_assets', action='store_true', help='debug asset bundling') parser.add_option('--build-assets', dest='_build_assets', action="store_true", help='bundle assets') (opts, args) = parser.parse_args() # Load config file if specified if opts.config is not None: app.config.from_pyfile(opts.config) # Overwrite only those settings specified on the command line for k in dir(opts): if not k.startswith('_') and getattr(opts, k) is None: delattr(opts, k) app.config.from_object(opts) if opts._debug_assets: app.config['DEBUG'] = True app.config['ASSETS_DEBUG'] = False else: app.config['ASSETS_DEBUG'] = app.config['DEBUG'] if opts._build_assets: from webassets import script script.main(['build', '--production'], env=assets) else: app.run(host=opts.host, port=opts.port, threaded=True)