1. fanstatic
  2. fanstatic
  3. fanstatic
Issue #74 resolved

minified .js not served in bottom unless force_bottom [patch]

tobes_
created an issue

When a javascript resource with bottom=True is created and a minified version is provided the minified resource does not inherit the bottom=True.

This prevents the true value of fanstatic being realised

bug present at commit 636ee4170bc3

To test create a resource {{{ r = Resource(lib, 'script.js', minified='script.min.js', bottom=True) }}}

with config {{{ [filter:fanstatic] use = egg:fanstatic#fanstatic minified = false bottom = true }}} script.js is at the bottom

with config {{{ [filter:fanstatic] use = egg:fanstatic#fanstatic minified = true bottom = true }}} script.min.js is served in the head

FIX

Allow the minified resource to inherit bottom value for the resource

before {{{

core.py line 388

        elif isinstance(argument, basestring):
            mode_resource = Resource(library, argument)
        else:

}}} after {{{

core.py line 388

        elif isinstance(argument, basestring):
            mode_resource = Resource(library, argument, bottom=bottom)
        else:

}}}

If you prefer this patch as a pull request let me know in this ticket

cheers, keep up the good work

Comments (3)

  1. faassen

    Thanks for this report! I've fixed the error and also added a unit test to test_core to demonstrate the error. Take a look at test_html_bottom_safe_used_with_minified.

  2. Log in to comment