Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Change js/css file doesn't trigger browserSync to reload the page #585

Closed
hanfeisun opened this issue Aug 11, 2015 · 14 comments · Fixed by #604
Closed

Change js/css file doesn't trigger browserSync to reload the page #585

hanfeisun opened this issue Aug 11, 2015 · 14 comments · Fixed by #604

Comments

@hanfeisun
Copy link

Currently, the livereload property of browserSync looks like this:

  livereload: {
    options: {
      files: [
        '<%= config.app %>/{,*/}*.html',
        '.tmp/styles/{,*/}*.css',
        '<%= config.app %>/images/{,*/}*',
        '.tmp/scripts/{,*/}*.js'
      ],
      port: 9000,
      server: {
        baseDir: ['.tmp', config.app],
        routes: {
          '/bower_components': './bower_components'
        }
      }
    }
  },

When I change and save app/index.html, browserSync works well and reload the page. However, when I change and save app/scripts/main.js or app/styles/main.css. The watch:babel or watch:styles tasks are triggered and the compiled js or css file are generated in .tmp folder, but somehow the browser doesn't reload at all...

@0xgeert
Copy link

0xgeert commented Aug 11, 2015

Same here. Straight out of box. Exact same problem

@0xgeert
Copy link

0xgeert commented Aug 11, 2015

changing to '.tmp/styles/**.css' just works for my simplistic case, but not sure how the match differs from '.tmp/styles/{,*/}*.css' to be honest

@eddiemonge
Copy link
Member

Try adding watchTask: true to the browserSync grunt config and see if that fixes it

@masakura
Copy link
Contributor

It is thought that the cause of this bug is micromatch. browserSync are using micromatch.

micromatch/micromatch#38

@tconroy
Copy link

tconroy commented Aug 18, 2015

Any updates or workarounds for this? I've changed the globbing pattern to **/*.scss but it's not live-reloading.

@rafaortman
Copy link

Till they solve the issue, check gebrits' suggestion. It works just fine.

@tconroy
Copy link

tconroy commented Aug 18, 2015

not working for me.. Inside styles/ I have multiple sub-folders (base/,modules/,etc). I import all these sub-folder files into styles/main.scss. However when I modify one of the sub-folder files, my browser is not getting live-reloaded.

@silvenon
Copy link
Member

Sorry guys, I was trying to find out why it doesn't reload, but haven't solved it yet…

@graywithanA
Copy link

Same problem here except following gebrits suggestion and changing {,*/}*.js to **.js doesn't fix the issue for me.

Has anyone found a different solution?

@silvenon
Copy link
Member

We'll switch to using BrowserSync directly, like shakyShane advises.

@rudenko-maksym
Copy link

I changed all .tmp/... paths to tmp/... (removed the dot) and know everything works as expected.

$> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.3 LTS
Release:        14.04
Codename:       trusty
$> node --version
v0.10.33

@baraamashaal
Copy link

@rudenko-maksym
that's works

@tconroy
Copy link

tconroy commented Sep 14, 2015

Thanks @rudenko-maksym 👍

@silvenon
Copy link
Member

The fix is released in v1.1.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants