FountainJS / generator-fountain-angular1

Yeoman 'fountain' generator to start a webapp with Angular 1
http://fountainjs.io
MIT License
95 stars 34 forks source link

Browsersync doesn't detect new HTML #84

Open IdanCo opened 7 years ago

IdanCo commented 7 years ago

I've created a new project and add a new component using the generator -

yo fountain-angular1:component --name myComponent --dir components/game

I've added references to the new component and successfully used it in the code:

import angular from 'angular';

import {hello} from './app/hello';
import 'angular-ui-router';
import routesConfig from './routes';

// here is the new component
import {myComponent} from './app/components/game/myComponent';

import './index.scss';

export const app = 'app';

angular
  .module(app, ['ui.router'])
  .config(routesConfig)
  .component('myComponent', myComponent) // <---- here as well
  .component('app', hello);

changing the js file of the new componenet triggers a browsersync reload. BUT - changing the html file of the new component doesn't trigger a reload.

Any idea why?

{
  "generator-fountain-angular1": {
    "version": "1.0.0-rc2",
    "props": {
      "css": "scss",
      "resolved": "/Users/idancohen/.nvm/versions/node/v4.2.4/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-angular1/generators/app/index.js",
      "framework": "angular1",
      "argv": {
        "remain": [],
        "cooked": [],
        "original": []
      },
      "js": "babel",
      "modules": "webpack",
      "ci": [],
      "namespace": "fountain-angular1",
      "sample": "techs",
      "router": "uirouter"
    }
  }
}

Relevant Links

nothing special about it but i've uploaded the repo - https://github.com/IdanCo/test-browsersync

Environment

Node.js v4.2.4
darwin 16.3.0
yo 1.8.5
npm 4.1.1
IdanCo commented 7 years ago

i traced the issue to this line

changing from this - gulp.watch(conf.path.tmp('index.html'), reloadBrowserSync);

to this - gulp.watch(conf.path.src('app/**/*.html'), reloadBrowserSync);

solves the issue, but since it's a whole conditional segment I feel I'm missing something... am i wrong? worth a PR?

IdanCo commented 7 years ago

Breakthrough!

I found out the if i change the export part of the component from this

templateUrl: 'full/path/to/component.html to this template: require('./component.html')

Then Browsersync listens to changes. Any idea why?