alexisvincent / systemjs-hot-reloader

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
MIT License
228 stars 36 forks source link

added optional params - **fileChanged**, to be able mange manually fi… #144

Closed wegorich closed 5 years ago

wegorich commented 7 years ago

So I've got pretty annoying issue with System.js Aurelia and .html templates. First of all I have to append !text loader each time. And even I change the path at the browser-sync lvl, I still have no possibility receive events from .html change, using systemjs-plugins. code sample

So it would be really good to have possibility to override fileChanged common logic.

System.import('systemjs-hot-reload').then((connect) => {
  connect({
         fileChanged: (event, fileChanged, options)=> {
             //fix urls or other stuff...
             fileChanged(even).then(()=> {
                    //extra place for mange file reload stuff
             }); 
         }
  })
});
wegorich commented 7 years ago

Yeah, for the plugin.

In general is, I needs to mange .html templates, the hidden by the text-plugin. I don't find working solution over the systemjs plugins. And comes with idea to allow systemjs-hot-reloader user manage the files manually if needed. For example like this. Full sample attached in the top link.

if (event.url.startsWith('src/')) return;
 if (SystemJS.loads[formatTextUrl(cwd(event.url))]) {
           event.url = formatTextUrl(event.url);
 }
  
 fileChanged(event).then(()=>{
    changeAureliaFiles(event.url.split('!')[0]);
 });
Ogglas commented 5 years ago

Will this be merged?

alexisvincent commented 5 years ago

🎉