diff --git a/src/commands/serve.js b/src/commands/serve.js index 1ef21f5..b6f127e 100644 --- a/src/commands/serve.js +++ b/src/commands/serve.js @@ -29,7 +29,7 @@ const deleted = function (file) { }, ReloadTemplates = function ReloadTemplates () { let watcher = new Watch(path.join('views', '*'), { - ignored: '**/**/', + ignored: 'views/ember_apps', persistent: true, ignoreInitial: true, alwaysStat: false, @@ -40,6 +40,7 @@ const deleted = function (file) { }); watching.push(watcher); watcher.on('change', async (file) => { + console.log('ReloadTemplates', file); livereload.reload(); }); }, diff --git a/src/deamon.js b/src/deamon.js index 6586179..09fde0a 100644 --- a/src/deamon.js +++ b/src/deamon.js @@ -71,6 +71,7 @@ export default function StartKoatonServer (resolve, reject, EmberPids, nginx = f 'public', 'commands', 'koaton_modules', + 'views/ember_apps/*', 'views/*.*', 'downloads', 'config/bundles.js', @@ -81,6 +82,7 @@ export default function StartKoatonServer (resolve, reject, EmberPids, nginx = f }); let server = LoadServer(resolve, reject, EmberPids, nginx); watcher.on('all', (event, path) => { + console.log(123, event, path); server.kill(); server = LoadServer(resolve, reject, EmberPids, nginx); }); diff --git a/src/support/BundleItem.js b/src/support/BundleItem.js index bdbc962..829b84d 100644 --- a/src/support/BundleItem.js +++ b/src/support/BundleItem.js @@ -78,7 +78,7 @@ export default class BundleItem { this.watcher.unwatch(f); }); } catch (Ex) { } - let data = await builder(this.file, this, configuration.server.env === 'development', false, logger); + let data = await builder(this.file, this.content.slice(0), configuration.server.env === 'development', false, logger); let sources = []; let files = []; for (const key in data) { diff --git a/src/support/CheckBundles.js b/src/support/CheckBundles.js index e8b83f8..da6ab62 100644 --- a/src/support/CheckBundles.js +++ b/src/support/CheckBundles.js @@ -5,6 +5,7 @@ import BundleItem from './BundleItem'; import { watch as Watch } from 'chokidar'; import { resolve } from 'path'; import hasfile from '../utils/hasfile'; +import { buildCSS, buildJS } from '../functions/builder'; let allBundles = {}; let hashes = {}; @@ -89,7 +90,7 @@ async function checkbundles () { await mkdir(ProyPath('public', 'js'), null); for (const bundle of configuration.bundles) { let b = allBundles[bundle.file] = new BundleItem(bundle.file, bundle.content, true); - await b.build(logger); + await b.build(logger, bundle.kind === '.css' ? buildCSS : buildJS); b.watch(onChange.bind(null, b)); makehashes(b.sources); } diff --git a/src/support/EmberBuilder.js b/src/support/EmberBuilder.js index 267c8d2..636fa3f 100644 --- a/src/support/EmberBuilder.js +++ b/src/support/EmberBuilder.js @@ -183,6 +183,7 @@ export default class EmberBuilder { } createWatcher (reload) { let watcher = new Watch(ProyPath('public', this.directory, '**/*'), { + // ignored: , persistent: true, ignoreInitial: true, alwaysStat: false, @@ -197,15 +198,16 @@ export default class EmberBuilder { // }); // }; let fileSelector = async (file) => { + console.log('fileSelector', file); if (file.indexOf('index.html') > -1) { await this.postbuild(); - reload(); + // reload(); // rebuildview(); - } else if (file.indexOf('.css')) { + } else if (file.indexOf('.css') > -1) { if (file.indexOf('.map') === -1) { reload(basename(file)); } - } else if (file.indexOf('.js')) { + } else if (file.indexOf('.js') > -1 && file.indexOf('testem.js') === -1) { if (file.indexOf('.map') === -1) { reload(basename(file)); }