Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

JST debug behavior is broken #102

Closed
sean-lynch opened this Issue · 1 comment

2 participants

Sean Lynch Michael Elsdörfer
Sean Lynch

Debug = True or Debug = 'merge' breaks the applications that depend on JST to compile their templates. The JST filter should be run regardless of the value of the debug flag as simply merging the unprocessed HTML files into a single file doesn't make those templates retrievable by Javascript.

For an trivial example, see: https://github.com/sean-lynch/flask-assets-issues/blob/master/1/webassets-test.py - If you uncomment either of the debug flags, the resulting file is simply merged HTML, and not a JST object.

The work around is set the debug flag on any bundle that uses JST to false, but as far as I can tell, that needs to be done in code as a hack when setting up the environment. See: https://github.com/holdenmatt/webapp-boilerplate/blob/master/server/app.py

Michael Elsdörfer
Owner

This is a problem also with css and js compiler filters. The original design intention was to use the debug flag with nested bundles:

http://elsdoerfer.name/docs/webassets/css_compilers.html

This does't work when defining bundles in templates, and it does't work when using things like the YAMLLoader, since nesting bundles isn't supported there.

I do intend to find a better solution. You may want to look at (and subscribe to) #12 and #60, which both touch on this.

#12 would introduce JSBundle/CSSBundle classes, which would solve the problem by constructing the correct nested Bundle structure internally.

#60 would approach this more directly by allowing filters to specify when they run.

Michael Elsdörfer miracle2k closed this
Michael Elsdörfer miracle2k referenced this issue from a commit
Michael Elsdörfer Limited ability for filters to run in debug mode.
Filters can now declare that they need to run in 'merge' mode (cssrewrite),
or that they need to run always (compiler-type filters).

In the latter case, if such a filter is used, the bundle will automatically be
merged. This is a more limited change than it sounds - still, see the section
on backwards-incompatibilities in the docs for more info.

Closes #60, and solves the requests in #73, #102 and possibly others.
Some relation to #120.
65311d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.