adams85 / bundling

A library for optimizing and bundling web assets of ASP.NET Core applications.
MIT License
44 stars 7 forks source link

Vuejs #4

Closed Diaskhan closed 5 years ago

Diaskhan commented 5 years ago

It is possible to use files with .vue extension ?

Hot good it works with vuejs.react.angular frameworks ?

adams85 commented 5 years ago

Hi!

Unfortunately, I'm not familiar with Vuex but odds are that you cannot make it work with the current release as it has only basic Javascript bundling features (in fact, it does just a basic concatenation + minification).

However, I'm working hard on v2.0 right now which is going to be able to bundle ES6 modules. As far as I know, Angular makes heavy use of modules and utilize TypeScript nowadays. There is already a working a sample in the repo which uses these features. You may check out the master branch and play with the demo to get a better idea what the new version will be capable of.

I'm putting the finishing touches, the new release is due in a week or so. I'm going to investigate how it plays with the SPA frameworks and I try to build in support for them if it doesn't involves much work.

So check back soon by all means! :)

Diaskhan commented 5 years ago

I am to dont like spa applications bundling in one js! Not familiar with node js enviroment!

Just like connect vuejs a simple jquery lib! https://jsfiddle.net/chrisvfritz/50wL7mdz/

1.How do work TS bundling ? Is there native C# transpiler from TS to JS ?

  1. Could u describe ts to js minification ?
adams85 commented 5 years ago

I don't like to have Javascript in my dev/build tool chain, either. :)

I put together another code sample for you: https://github.com/adams85/bundling/tree/master/samples/VueDemo

This one uses Vue with plain Javascript without ES6 modules or other fancy stuff. Because of this, it should work fine with 1.x versions of the library.

Regarding your questions: 1) My library doesn't include a native transpiler for TS currently (and probably it never will). Transpiling TS to JS is done by the .NET build system automatically, but nothing stops you from bundling the outputted js files. The method is demonstrated in the TypeScriptDemo sample.

2) You cannot minify TS files directly, but you can the output of the transpilation process just like any ordinary JS files.

Diaskhan commented 5 years ago

Thanks!

By the way look at https://github.com/ligershark/WebOptimizer/blob/master/README.md#content-root-vs-web-root U could borrow some ideas! This idea with IFileProvider looks interesting !

adams85 commented 5 years ago

Thanks for the info, I'll definitely take a look at it.

For that matter, file providers are supported in my lib from the beginning:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    // ...

    app.UseBundling(
        new BundlingOptions
        {
            SourceFileProvider = env.ContentRootFileProvider
        },
        bundles =>
        {
            // ...
        });

    // ...
}

You can use a file provider of your choice (so the input files don't have to necessarily come from physical file system, but also from embedded resources, etc).

In fact, you can even define bundles of multiple sources with different file providers. However, I don't think this is required too often.