0

Gruntfile.js connect piece:

connect: {
  options: {
    port: 4000,
    // Change this to '0.0.0.0' to access the server from outside.
    hostname: 'localhost',
    livereload: 4002
  },
  livereload: {
    options: {
      open: true,
      middleware: function (connect) {
        return [
          connect.static('.tmp'),
          connect().use(
            '/bower_components',
            connect.static('./bower_components')
          ),
          connect().use(
            '/app/styles',
            connect.static('./app/styles')
          ),
          connect.static(appConfig.app)
        ];
      }
    }
  }

Package.json (npm):

{
  "name": "ukrbook",
  "version": "0.0.0",
  "license": "MIT",
  "description": "text",
  "dependencies": {
    "chokidar": "^1.4.3",
    "grunt-contrib-imagemin": "^1.0.0",
    "livereload-js": "^2.2.2"
  },
  "repository": {},
  "devDependencies": {
    "connect-livereload": "^0.5.4",
    "grunt": "^0.4.5",
    "grunt-autoprefixer": "^3.0.4",
    "grunt-concurrent": "^2.2.1",
    "grunt-contrib-clean": "^1.0.0",
    "grunt-contrib-concat": "^1.0.0",
    "grunt-contrib-connect": "^1.0.1",
    "grunt-contrib-copy": "^1.0.0",
    "grunt-contrib-cssmin": "^1.0.1",
    "grunt-contrib-htmlmin": "^1.1.0",
    "grunt-contrib-imagemin": "^1.0.0",
    "grunt-contrib-jshint": "^1.0.0",
    "grunt-contrib-uglify": "^1.0.1",
    "grunt-contrib-watch": "^1.0.0",
    "grunt-filerev": "^2.1.2",
    "grunt-google-cdn": "^0.4.3",
    "grunt-karma": "^0.12.2",
    "grunt-newer": "^1.1.0",
    "grunt-ng-annotate": "^2.0.1",
    "grunt-svgmin": "^3.1.2",
    "grunt-usemin": "^3.0.0",
    "grunt-wiredep": "^2.0.0",
    "jasmine-core": "^2.2.0",
    "jshint-stylish": "^2.1.0",
    "karma": "^0.13.22",
    "karma-jasmine": "^0.3.5",
    "karma-phantomjs-launcher": "^1.0.0",
    "load-grunt-tasks": "^3.1.0",
    "serve-static": "^1.10.2",
    "time-grunt": "^1.0.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

The problem is somehow livereload doesn't want to load. It give me a console error. It shows up just as I run 'grunt serve' and reload the page: enter image description here I've tried lots of stuff, changing hostname, livereload, some parameters, reinstalling livereload, but I just can't get it. What's the problem? It just doesn't see it there. enter image description here

Fleeck
  • 1,036
  • 2
  • 8
  • 21

1 Answers1

0

So, the answer is just to require('serve-static') like this:

var serveStatic = require('serve-static')

and change connect.static to serveStatic as it's written here:

Warning: connect.static is not a function Use --force to continue

Somehow it works.

Community
  • 1
  • 1
Fleeck
  • 1,036
  • 2
  • 8
  • 21