3

I am an angular newbie and trying to run grunt with angular. My grunt file looks like this, which plugin or module do I need to add to serve an angular app? I tried grunt-contrib-watch:

module.exports = function(grunt) {

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),
        sassFiles: 'app/**/*.scss',

        sass: {
            dist: {
                files: {
                    'build/site.css': 'app/site.scss'
                }
            }
        },

        watch: {
            sass: {
                tasks: ['sass'],
                files: 'app/**/*.scss'
            }

        },
        another: {
            files: ['app/*.js'],
            tasks: ['anothertask'],
            options: {
                // Start another live reload server on port 1337
                livereload: 1337
            }
        }
    });


    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-sass');


    grunt.registerTask('dev', ['default', 'watch','another']);
    grunt.registerTask('default', ['sass']);

};
Prasad
  • 1,562
  • 5
  • 26
  • 40
bier hier
  • 20,970
  • 42
  • 97
  • 166

1 Answers1

1

grunt-contrib-watch run a task when files change (created,updated, etc..). To serve an angular app , try the plugin "grunt-serve".

Charles
  • 170
  • 11
  • Ok just wondering if it is possible to use npm without using a gruntplugin? – bier hier Mar 08 '16 at 08:57
  • Npm is only a package manager which install grunt and his plugins (or something else). But if you want to create a web server with Node.js, you can, it's explained here: http://stackoverflow.com/a/8427954/5368495 – Charles Mar 08 '16 at 09:05