Frage

I have a project that uses grunt to build my site from a Jade template and also builds and concatenates JavaScript using an uglify task (grunt-contrib-uglify).

As I am building a single page app, rather than link to the external uglified version of my JavaScript I would like to build the uglified version into my jade template and save on the extra http request.

Within my grunt file, how can I get uglify to pass its content into the my Jade template rather than build it as an external file?

Any thoughts welcome.

War es hilfreich?

Lösung

One approach would be to simply pass the uglified javascript string as data for your jade template. For the jade task, use a function for your data key which reads and returns the contents of the uglified file (using grunt.file.read for example).

Obviously ensure your uglified task is run before your jade task.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top