gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com
MIT License
714 stars 146 forks source link

File not being served #197

Open mturnwall opened 8 years ago

mturnwall commented 8 years ago

I have a task that is serving multiple directories. The files in one of the directories is not being served. The browser reports Cannot GET /.tmp/includes/jsbin/check_compat.js.

Here is my task.

dist: {
    options: {
        base: ['.tmp', '<%= config.dist %>'],
        open: {
            target: 'http://localhost:<%= connect.options.port %>?envMode=apiary&testing=true'
        }
    }
}

The files in the .tmp directory can't be found by the browser. If I set the base to just .tmp the page loads and I can browser that folder. When I add the second folder I get no such luck.

The .tmp folder holds my transpiled javascript files and the sourcemap points to the source files in this directory. So in my browser's dev tools I can see the directory of the source files, but when I click on a file it's empty. If I right click on the file and select "Open file in new tab" I get the error message Cannot GET /.tmp/includes/jsbin/check_compat.js.

Here is a list of files the browser shows in dev tools.

image

So I know that the sourcemap is working correctly. I've been trying to fix this for a few days now.

mturnwall commented 8 years ago

I still ca't get this to work. Here is my current connect task.

server: {
    options: {
        base: ['app', '.tmp'],
        open: true
    }
}

.tmp holds my compiled css and javascript files. app is my main application folder. The index.html file is in app and it gets served just fine. All the compiled files in .tmp load as well. In dev tools for both Firefox and Chrome I see the link to the sass source file. If try to view the sass source files I get 404 errors.

Here is the debug from the server. The css folder is in the .tmp folder.

[D] server GET /css/master.css 304 - - 0.620 ms
[D] server GET /css/master.css.map 200 459 - 1.947 ms
[D] server GET /app/css/sass/_theme.scss 404 37 - 1.037 ms
[D] server GET /app/css/sass/modules/_module_rotator.scss 404 54 - 0.713 ms
[D] server GET /app/css/sass/master.scss 404 37 - 0.619 ms
[D] server GET /app/css/sass/_modulesMap.scss 404 42 - 0.981 ms

I'm having this issue across multiple projects.