BundlerMinifier and WebCompiler does not output fi

2019-07-22 12:15发布

问题:

We've just removed Gulp from our build and using the Bundler & Minifier (https://github.com/madskristensen/BundlerMinifier) and Compiler (https://github.com/madskristensen/WebCompiler) and both the bundleconfig.json and compilerconfig.json have "Enable bundle on build" and "Enable compile on build" ticked, but when I build or rebuild the solution, none of the output files are generated. If I right-click the json's and either "Update bundles" or "Re-compile all files" manually, then the files are generated all lovely jubbly. I did read that these packages would not compile on build due to bootstrap and would only compile on build if there are corresponding css and js output files already in the solution but I may have read that wrong ... Ideally I don't want to have to incl. all the files in GIT when merging my code up. Any help would be really useful. Thank you!

回答1:

I believe you need to define each file you want to build. It's not as nice as gulp in that it allows wildcards. If you right click and select the WebCompile option on each file it should add an entry for you in the compilerconfig.json We're having our own struggles with this great product in that we can't get it to compile, bundle, and minify without Visual Studio. I want to run it in CI without Visual Studio 2015, just Microsoft Build Tools 2015.



回答2:

I've been struggling with this problem all morning as my development environment uses a JS file to debug easier and my production uses a minified version which wasn't being updated on save or build.

I tried to use each and all three of BundlerMinifier, WebCompiler and WebEssentials all with VS2017. Less files were OK, JS wouldn't compile at all unless I did it manually (right click on file or change compilerconfig.json which updates all).

In the end, I used the Task Runner Explorer and used a binding to 'Before Build' for my JS file. Everything previously compiled on save and I've just noticed my minified edition is three months old, so obviously a problem with an extension or VS update somewhere. Because I'm a bit paranoid, I've bound the Less files too just in case and at least now it's automated.