Giter VIP home page Giter VIP logo

bundling's People

Contributors

adams85 avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bundling's Issues

Vuejs

It is possible to use files with .vue extension ?

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

EcmaScript - NullReferenceException when variable is not declared

Hi adams85,

On javascript when a variable is not declared we get System.NullReferenceException: 'Object reference not set to an instance of an object.' at VisitVariableDeclarator.

[TO REPRODUCE]
On TypeScriptDemo add to foo.ts var i, length; just after the _timeout function.

[POSSIBLE FIX]
Execute Visit(variableDeclarator.Init) only if Init is not null

protected override void VisitVariableDeclarator(VariableDeclarator variableDeclarator)
{
if (variableDeclarator.Init != null)
{
// id skipped
Visit(variableDeclarator.Init);
}
}

Thank you

(I'm actually looking how to pull new request, sry i'm new to github)

JS: Multiple mobile versions give syntax errors after bundeling.

Getting multiple errors from sentry on syntax errors after bundeling.
Just tested on iPhone 11 pro 13.2, and the not-bundeled JS works perfectly, but after bundeling gives a syntax error.
image
image

Code:
target.forEach((el)=>{ if (el.name.includes(',')) { const arr=el.name.split(','); arr.forEach((str)=>{ const sec=window.data.find(x=>x.name=== str); if (sec) { result.push(sec.id); } } ); } else { result.push(el.id); } } ); result.forEach((id)=>{ dowork(id); } ); }

Issue when script file has been modified outside of Visual studio

Hi,
I'm not sure if this has been mentioned before. But I have a problem with Karambolo.AspNetCore.Bundling.BundlingOptions and javascript files being modified outside of Visual Studio.
If a file is modified when the solution isn't opened in Visual studio, no new version number is generated and you get an old version of the bundle when running localhost with no other way of getting a new version without adding yet another change (e.g. a space).

If it's not possible to fix within the package by you, is there a way to force it to update the version number in any way manually from Visual studio for all bundles?
We have a lot of bundles in our solution, so it's not possible to manually make a change inside of each time e.g. after a merge from another branch where several files might have been changed outside of VS.

Thx

How to apply transforms to a Bundle like we used to do in Asp.Net MVC 4?

In Asp.Net 4 we use to do bundling via BundleConfig => RegisterBundles via the following way:

    foreach (var culture in languageCultures)
    {
        var modulesGlobalsJSBundle = new Bundle(string.Format("~/Scripts/modulesGlobalsJS-{0}", culture.code))
        .Include("~/Scripts/MyModules/build/my-modules.js");

       modulesGlobalsJSBundle.Transforms.Clear();
       modulesGlobalsJSBundle.Transforms.Add(new JSTranslator());
       modulesGlobalsJSBundle.Transforms.Add(new JsMinify());

      bundles.Add(modulesGlobalsJSBundle);
    }

That is, a separate bundle will be created for each culture available via list of languageCultures.

Now I can't find way in Asp.Net Core to apply transform to my static files application startup. We used JSTranslator earlier as a transform (shown in code above) for replacing any localizable strings present in .js files w.r.t current UI culture.

How can we do that using your way of Bundling and Minification?
A sample would be of great help. Thanks in advance.

Tree shaking in EcmaScript

Hi adams85 and thanks for this great bundling.

I'm using EcmaScript for ES6 support and it seems the whole file has being imported. Is it possible to eliminate dead code and import only what is really needed?

TO REPRODUCE THE CASE:
In TypeScriptDemo add a "treeShaking" function to foo.js. Running the application main.js will include the function, even if it has not been imported.

WHAT EXPECTED:
main.js without the "treeShaking" function.

asp-append-version tag doesn't seem to work with bundled script

I would like to add a version number to the URL of my bundled scripts. In my project, I'm using the asp-append-version tag, which calculates a hash and appends to the script. For all my non-bundled scripts, this tag works fine. However, when I use with a bundled script, nothing is added to the URL. See content below.

Is there a work around or something built into the bundler for append a version? I want to make sure that users' browsers don't use cached bundles when a new, updated version is available.

Source:
<script src="~/bundles/scripts/table-bundle.js" asp-append-version="true"></script> <script src="~/Scripts/clients/dashboard/dashboardPage.js" asp-append-version="true"></script>

Output:
`<script src="/bundles/scripts/table-bundle.js"></script>

<script src="/Scripts/clients/dashboard/dashboardPage.js?v=8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U"></script>`

Cannot access node_modules folder

Hi everyone!

I'm trying to import scss file from node_modules in wwwroot/scss and I'm getting this error:

[13:28:55 Warning] Karambolo.AspNetCore.Bundling.Sass.SassCompiler
Sass compilation of '/scss/main.scss' failed.
Error: File to import not found or unreadable: ../../node_modules/blip-toolkit/dist/scss/variables/module.scss.
        on line 1 of scss/main.scss
>> @import "../../node_modules/blip-toolkit/dist/scss/variables/module.scss";

I've checked if path is correct and it is. Can anyone tell me if this package has some restriction to import scss files from node_modules?

Thanks!

Question: How to handle client side caching

Hi,

First of all, what a perfect library. I use it on multiple websites I developed.

The question I have is when I use EnableCacheHeader the client perfectly caches the bundled CSS and JS.
When I create a new deployment, I want to invalidate that cache.
Is there a way to invalidate that cache on new versions, with keeping the EnableCacheHeader?

I've tried:

  • Using asp-append-version="true"
  • Checking out the example projects

Using CDN

Do we have a possibility use CDN?

Are there plans to update bundling tools to target .NET 7?

Are there plans to update the tools application to target .NET 7?

Currently, the tools appear to require the .NET Core 3 runtime.

I've included my command line output to show the runtimes and SDKs that are available in my local environment, as well as the output from running dotnet-bundle --version

> dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

> dotnet --list-sdks
6.0.413 [C:\Program Files\dotnet\sdk]
7.0.201 [C:\Program Files\dotnet\sdk]
7.0.307 [C:\Program Files\dotnet\sdk]

> dotnet tool install -g dotnet-bundlingtools
You can invoke the tool using the following command: dotnet-bundle
Tool 'dotnet-bundlingtools' (version '3.6.1') was successfully installed.

> dotnet-bundle --version
You must install or update .NET to run this application.

App: C:\Users\jholzer\.dotnet\tools\dotnet-bundle.exe
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '3.0.0' (x64)
.NET location: C:\Program Files\dotnet\

The following frameworks were found:
  5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.14 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.15 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.16 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.18 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  6.0.21 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  7.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  7.0.10 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.0.0&arch=x64&rid=win10-x64

Render individual includes

Is there a way to configure the bundling to render each file individually like classic ASP.NET bundling when using <compilation debug="true" /> in the web.config?

.Net Core 3 issues

I am converting an older project from Asp.Net MVC 4 and found your library. I figured I would go straight with .net core 3 however there have been a couple of issues.

Microsft has deprecated the IHostingEnvironment in favour of IWebHostEnvironment. This means the UseDefaults extension method doesn't work.
Also, when running the project I get a method not found exception
Method not found: 'Void Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware

Let me know if I can provide more info.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.