Example #1
0
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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
def test_script():
    """Test simply that the main script can be invoked."""
    main([])
Example #5
0
def main():
    script.main(sys.argv[1:], env=assets_env)
Example #6
0
def test_script():
    main([])
Example #7
0
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)
Example #8
0
def assets_rebuild():
    from webassets import script
    env = app.jinja_env.assets_environment
    script.main(('build', '--no-cache'), env=env)
Example #9
0
    '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)
Example #10
0
    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)
Example #11
0
def main():
    script.main(sys.argv[1:], env=env)
Example #12
0
 def run(self, *args):
     from webassets import script
     app = create_app()
     script.main(args, env=app.assets)
Example #13
0
 def run(self, *args):
     from webassets import script
     script.main(args, env=app.assets)
 def run(self, *args):
     from webassets import script
     app = create_app()
     script.main(args, env=app.assets)
Example #15
0
    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)
Example #16
0
 def run(self, *args):
     from webassets import script
     script.main(args, env=app.assets)