动态捆绑与MVC6 / ASP。网5

时间:2022-12-04 18:40:58

Previously with MVC5 and ASP.Net 4.5 there was Bundling and Minification as a server side action. The fine thing IMHO about this was, that I was able to have some code to be executed which discovers files to be included - even if these files weren't present at development time. Imagine a platform, where modules can be uploaded - with a module having e.g. SCSS and/or JSX included. Those modules are unpacked somewhere on the file system (App_Data for example) and my code searches for all relevant stuff there and adds it to my bundles.

先前与MVC5和ASP。Net 4.5将捆绑和缩小作为服务器端操作。让我感到高兴的是,我可以执行一些代码来发现要包含的文件——即使这些文件在开发时不存在。假设有一个平台,其中可以上传模块——其中包含一个模块,例如SCSS和/或JSX。这些模块在文件系统(例如App_Data)的某个地方解压缩,我的代码在那里搜索所有相关的内容并将其添加到我的包中。

Now with ASP.Net 5 there is no such bundling anymore but instead the option to write gulp tasks for that. As far as I understand (but maybe I'm just wrong?) these tasks are executed at development/publish time - and: locally. Whatever might get uploaded as described above hence is not discovered.

现在与ASP。Net 5不再有这样的捆绑了,取而代之的是可以为它编写狼吞虎咽的任务。就我所知(但也许我错了?)这些任务是在开发/发布时执行的——并且:本地执行。如上文所述,任何可能被上传的内容都不会被发现。

Is there a way to have such a gulp task get executed by - let's say: an OWIN middleware? Or is there another - maybe better - option to get this done?

是否有一种方法可以让这样一个gulp任务由一个OWIN中间件执行?还是有其他更好的选择来完成这件事?

Thanks for any hints,

谢谢你的提示,

Mario

马里奥

P.S. A good example of such a system with modules uploaded and bundled at startup is: https://github.com/VirtoCommerce/vc-community

这样一个系统的一个很好的例子是:https://github.com/VirtoCommerce/vc-community

1 个解决方案

#1


1  

these tasks are executed at development/publish time - and: locally

这些任务在开发/发布时执行,并且在本地执行。

You're correct; that's the intent. What you want to do is publish the result of those gulp tasks. For example, if you're using Browserify, publish the .js file and .css file that is produced by the gulp-browserify task. Similarly for Webpack.

你是正确的;的意图。您要做的是发布这些吞咽任务的结果。例如,如果您正在使用Browserify,请发布由gulp-browserify任务生成的.js文件和.css文件。同样Webpack。

#1


1  

these tasks are executed at development/publish time - and: locally

这些任务在开发/发布时执行,并且在本地执行。

You're correct; that's the intent. What you want to do is publish the result of those gulp tasks. For example, if you're using Browserify, publish the .js file and .css file that is produced by the gulp-browserify task. Similarly for Webpack.

你是正确的;的意图。您要做的是发布这些吞咽任务的结果。例如,如果您正在使用Browserify,请发布由gulp-browserify任务生成的.js文件和.css文件。同样Webpack。