Open mikedon opened 8 years ago
I'm in favor of this change; I am using a npm script with onchange to watch a folder and the file change will trigger a build with ng-html-js. It doesn't work until the file is changed,, and I don't have the output combined to one file yet; but its a hacky-start to allow ng-html2js to work with file globs.
On the console
npm install onchange -g
In package.json:
{
...
"scripts": {
...
"watch:html": "onchange \"**/*.html\" -- ng-html2js \"{{changed}}\" \"{{changed}}\".js -m MyModuleName --module-var MyModuleVar"
},
...
}
On the console:
npm run watch:html
(nothing will happen)
For the magic: Make a change to an html file and a companion js file will be generated as long as the watch:html is running.
There's probably a method that can take the combined output and process the directory without the files being changed, but this is what I came up with in 10 mins.
From what I can tell this only support one file. I could probably invoke the module multiple times but each time I would get the ngModule lookup code. In my projects I have many html files that live close to their respective controllers.
I'll submit a PR if you think this functionality should be added.