3

Here's a typical jade view

extend layout
  block head
    script(src="/js/polyfills/html5shiv.js")
  block body
    header
      nav...
    main
      section
      form...
    footer
      nav...
    script(src="/js/polyfills/arrayGenerics.js")
    script(src="/js/polyfills/placeholder.js")
    script(src="/js/formSubmitter.js")

Normally this is turned into HTML, but wouldn't it be nice if the javascript were concatenated and uglified (or at least just concatenated) before it hit the browser?

Stylus does this for CSS quite nicely. Is there a way to interrupt jade before it renders HTML? Meaning, can I run custom js in my app.js file before the html hits the browser?

Costa Michailidis
  • 7,691
  • 15
  • 72
  • 124
  • [grunt-usemin](https://github.com/yeoman/grunt-usemin#blocks) does this. Checkout [this answer](http://stackoverflow.com/a/20539102/1266650) – laggingreflex May 25 '15 at 14:23
  • 1
    Personally I use `if(dev)` `if(production)` blocks and put appropriate minified or full versions of files. – laggingreflex May 25 '15 at 14:24

0 Answers0