Minify require_js Javascript


#1

How would I go about getting code within a {% require_js %} block minified?

That is, something like:

{% require_js %}
  <script>
    alert('Hello world!');
    // do something else
  </script>
{% end_require_js %}

#2

Hi @brookjordan,

Scripts included in a require_js block will be included server-side, and all assets should be served minimized by default.


#3

It doesn't appear to be.

See ~ line 2080 of the source-code here:


Currently the 5th inline script tag.

I generally minify all of my code but haven't done so with that one yet. Something like this should be getting minified?

If it helps, here's the code file:
https://app.hubspot.com/design-manager/407937/modules/5358552290


#4

Hi @brookjordan,

Thank you for the examples, that was helpful. I touched base with product, and it turns our we don't minify inline JS. In order for JS to be minified automatically, it has to be hosted in the design manager as a JS file and included that way.