Find a post...

DNN-Connect Blogs

It's time to learn Grunt to automate development and design

Now that the Microsoft-Does-Everything-Different is dead and we all are moving to the development models of the future which embrace HTML and JavaScript - it's time to learn Grunt

What's it for?

Basically Grunt is a tool to automatically run scripts for you. These scripts do things like

  1. JavaScript - Linting: This is like finding compile time errors in JavaScript - awesome :)
  2. TypeScript or CoffeeScript compiling
  3. JavaScript compression: Create minified and bundled JS at dev time which us much better and more reliable than on-the-fly like DNN tries to do it. All modern JS does it this way - that's why you always get a ...min.js
  4. JavaScript Source-Map generation: This allows you to still debug JS even though it's minified
  5. LESS or SASS CSS compilation 
  6. JavaScript automation like Automatic-Annotation

How does it do that?

Grunt is JavaScript based and uses nodeJS. It basically looks at a file called gruntfile.js and does whatever is defined there in a batch-run. This file contains a bunch of things like:

  1. What plugins to load (because each action is an own plugin)
  2. What file-sets exist to be processed - like the list of "my css-files"
  3. Run each plugin against these files

This may sound complicated but you'll be amazed at how easy and fast this is. We've been using it on 2sxc for about half a year now and we love it!

Getting Started with Grunt

I'll write some tutorials as soon as we've added Grunt-support to 2sxc Apps. This should be released this week. If you can't wait, just try some online tutorials out there :). 

With love from Switzerland,
Daniel 

Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 700 DNN projects since 1999. He is also chief architect of 2sxc (see forge), an open source module for creating attractive content and DNN Apps.

Daniel Mettler learned programming with the bible translation computer of his parents, deep in the jungles of Indonesia. Since he was only 12 years old at that time and the BIOS only had a version of BASICA, that's what got him started. With 16 he went back to Switzerland and learned German and basic city-survival skills. Equipped with this know-how he founded 2sic internet solutions in 1999 which was focused on web solutions on the Microsoft platform. After a few self-developed CMSs 2sic switched to DNN in 2003 and has been one of the largest partners (17 employees, 700+ projects) in Europe. Daniel is also the chief architect behind the open source 2sxc, a strong promoter of standardization (boostrap, patterns, AngularJS, checklists, etc.) and loves to eat anything - dead or alive. His motto: if the natives eat it, it game.
Comment(s)

Hosting liberally provided by

Philipp Becker 6011 7
Geoff Barlow 547 4
DNN-Connect 431 6
Peter Donker 5055 30
Christopher Hammond 680 2
Olivier Jooris 419 1
Daniel Mettler 12007 88
Clint Patterson 1 1
Jos Richters 65 1
James Rosewell 327 2
Will Strohl 1546 27
Ernst Peter Tamminga 437 4
Barry Waluszko 2798 2
Declan Ward 450 1
Gifford Watkins 722 9
Torsten Weggen 2688 3