Grunt js无法在服务器命令的浏览器中打开

时间:2015-03-30 22:32:40

标签: gruntjs livereload

当我在我的终端上做“咕噜咕噜的服务”时,它只是坐着看着。它从不打开我的浏览器。我不确定我错过了什么。

看看这个并告诉我我做错了什么:

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js'
      },
      my_target: {
          files: {
            'js/min/main.min.js': ['js/main.js'],
            'js/min/libs.min.js': ['bower_components/jquery/dist/jquery.min.js','bower_components/bootstrap/dist/js/bootstrap.min.js']
          }
        }
    },
    compass: {
        dist: {
          options: {
            config: 'config.rb',  // css_dir = 'dev/css'
            sassDir: 'sass',
            cssDir: 'css',
          }
        }
    },
    watch: {
        all: {
            files: '**/*',
            options: {
                livereload: true
            },
        }
    },
    connect: {
       server: {
          options: {
            port: 8000,
            hostname: 'localhost',
          }
      }
    }

  });



  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-serve');

  // Default task(s).
  grunt.registerTask('build', ['uglify','compass']);
  grunt.registerTask('server', [
    'uglify',
    'compass',
    'watch',
    'connect'
    ]);

};

0 个答案:

没有答案
相关问题