Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Grunt.js (Norwegian)

Intro to Grunt.js (Norwegian)

Introduction to Grunt.js build manager.

Hans Kristian Flaatten

January 12, 2015
Tweet

More Decks by Hans Kristian Flaatten

Other Decks in Technology

Transcript

  1. HVA ER GRUNT? • Enkel automatisering av oppgaver • Sammenslåing

    og komprimering • Testing og linting • Kompilering osv. • Skrevet i v8 JavaScript (aka. Node.JS) 
  2. HVORFOR GRUNT? • Stabilt og veletablert • Enkelt å sette

    opp – enkelt å kjøre • Rikt økosystem med «støtte for det meste»
  3. KONFIGURER module.exports = function(grunt) { ! // Project configuration. grunt.initConfig({

    jshit: { options: { curly: true, eqeqeq: true, eqnull: true, }, files: [ 'Gruntfile.js', 'src/**/*.js', ] } }); ! // Load the plugin that provides the "jshint" task. grunt.loadNpmTasks('grunt-contrib-jshint'); ! // Default task(s). grunt.registerTask('default', ['jshint']); ! };
  4. LESS less: { compile: { options: { modifyVars: { imgPath:

    '"https://aws-s3..."' } }, ! files: { "less/app.less": "css/app.css" } } }
  5. FILE WATCHER watch: { js: { files: ['js/**/*.js'], tasks: ['compile:js']

    }, less: { files: ['less/**/*.less'], tasks: ['compile:less'] } }
  6. OG MANGE FLER... • grunt-contrib-imagemin • grunt-contrib-cssmin • grunt-contrib-csslint •

    grunt-contrib-concat • grunt-s3 • grunt-pylint • grunt-ssh-deploy • gruntjs.com/plugins
  7. Never gonna give you up Never gonna let you down

    Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you