wingman007

PortableNode_Gruntfile.js

Jun 10th, 2015
727
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = function(grunt) {
  2.     // run it wit grunt stoyan in the root of the project
  3.     grunt.registerTask('stoyan', function(){
  4.         console.log('Hello World from grunt!');
  5.     });
  6.    
  7.     // grunt speak
  8.     grunt.registerTask('speak', function(){
  9.         console.log('I am speaking!');
  10.     });
  11.    
  12.     // grunt both
  13.     grunt.registerTask('both', ['stoyan', 'speak']);
  14.    
  15.     // grunt
  16.     grunt.registerTask('default', ['stoyan', 'speak']);
  17.    
  18.     // in order to run concat you will need to run npm
  19.     // npm install grunt-contrib-concat --save-dev
  20.    
  21. /* https://github.com/gruntjs/grunt-contrib-concat 
  22.     // Project configuration.
  23.     grunt.initConfig({
  24.       concat: {
  25.         options: {
  26.           separator: ';',
  27.         },
  28.         dist: {
  29.           src: ['src/intro.js', 'src/project.js', 'src/outro.js'],
  30.           dest: 'dist/built.js',
  31.         },
  32.       },
  33.     });
  34. */
  35.     // Project configuration.
  36.     grunt.initConfig({
  37.       pkg: grunt.file.readJSON('package.json'), // you can use the pkg object
  38.       concat: {
  39.         options: {
  40.           stripBanners: true,
  41.           banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
  42.             '<%= grunt.template.today("yyyy-mm-dd") %> */',
  43.         },
  44.         dist: { // run with -> grunt concat:dist
  45.           src: ['src/project.js'],
  46.           dest: 'dist/built.js',
  47.         },
  48.         happy: { // run with -> grunt concat:happy
  49.           src: ['src/project.js'],
  50.           dest: 'build/scripts.js',
  51.         },
  52.         js: { // run with -> grunt concat:dist
  53.           src: ['src/js/main.js'],
  54.           dest: 'build/js/scripts.js',
  55.         },
  56.         css: { // run with -> grunt concat:happy
  57.           src: ['src/css/style.js'],
  58.           dest: 'build/css/styles.js',
  59.         },
  60.       },
  61.      
  62.       watch: {
  63.           js: {
  64.             // files: '**/*.js',
  65.             files: 'src/**/*.js',
  66.             // tasks: ['jshint'],
  67.             tasks: ['concat:js'], // whatever happens in the js files run concat
  68.             options: {
  69.               interrupt: true,
  70.             },
  71.           },
  72.           css: {
  73.             // files: '**/*.js',
  74.             files: 'src/**/*.css',
  75.             // tasks: ['jshint'],
  76.             tasks: ['concat'], // whatever happens in the js files run concat
  77.             options: {
  78.               interrupt: true,
  79.             },
  80.           },
  81.         },
  82.     });
  83.    
  84.     // Run this task with the grunt concat command
  85.     grunt.loadNpmTasks('grunt-contrib-concat');
  86.     // grunt watch
  87.     grunt.loadNpmTasks('grunt-contrib-watch');
  88.     // https://github.com/gruntjs/grunt-contrib-connect - very interstung as well
  89.     // https://www.npmjs.com/package/grunt-contrib-uglify
  90.    
  91.     // grunt.registerTask('default', ['concat', 'watch']);
  92. };
Advertisement
Add Comment
Please, Sign In to add comment