Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 6 #42

Closed
dustinlacewell opened this issue Jan 25, 2022 · 5 comments
Closed

.NET 6 #42

dustinlacewell opened this issue Jan 25, 2022 · 5 comments

Comments

@dustinlacewell
Copy link

Hi, does this library support .NET 6? Will it? Thanks.

@HybridSolutions
Copy link

Hi, does this library support .NET 6? Will it? Thanks.

Have you tried to use it with .NET 6?
I'm using it and it works great.

@dustinlacewell
Copy link
Author

Cool. 👍

@EmilAlipiev
Copy link

EmilAlipiev commented Mar 24, 2022

Net 6 is not working for me. How did you make it work? exact same code works fine with .net 5.

i am simply using

builder.Services.AddWebOptimizer(pipeline =>
{
    pipeline.CompileScssFiles();
    pipeline.AddCssBundle("/css/app.css", "/sass/app.scss");
});

app.scss file has partial scsss import

@import 'base';
@import 'button';
@import 'input';
@import 'modal';
@import 'sidebar'

but not working at all. without single code change .net 5 works fine

@HybridSolutions
Copy link

HybridSolutions commented Mar 25, 2022

I'm using it like this in a .NET 6 Razor pages + Blazor project with just Program.cs (no startup.cs):

In Program.cs

// ligershark WebOptimizer.Sass
    builder.Services.AddWebOptimizer(pipeline => {
        
        // Compile and bundle Base files
        // _init.scss, style.scss, components.scss require paths to be accurate to the project!
        pipeline.AddScssBundle("/css/style.bundle.css", "theme/sass/style.scss");
        pipeline.AddJavaScriptBundle("/js/scripts.bundle.js", "theme/js/components/*.js", "theme/js/app.js");

        pipeline.AddJavaScriptBundle("/js/plugins.bundle.js",
            "theme/plugins/bootstrap-multiselectsplitter/bootstrap-multiselectsplitter.js",
            "theme/plugins/bootstrap-session-timeout/dist/bootstrap-session-timeout.js",
            "theme/plugins/fslightbox/fslightbox.js",
            "theme/plugins/jquery-idletimer/idle-timer.js",
            "theme/plugins/smooth-scroll/smooth-scroll.min.js",
            "theme/plugins/toastr/toastr.min.js"
         );

        // Compile and bundle Plugin files
        pipeline.AddScssBundle("/css/plugins.bundle.css", "theme/sass/plugins.scss");

        // Compile font styles
        pipeline.AddScssBundle("/css/ecm-icon-font.css", "css/ecm-icon-font.scss");                
    });

My .scss files are inside "wwwroot\theme\sass" folder and my scripts inside "wwwroot\theme\js" folder.

My appsettings.json (Disk cache disabled only while in development!)

"webOptimizer": {
    "enableCaching": true,
    "enableMemoryCache": false,
    "enableDiskCache": false,
    "cacheDirectory": "/var/temp/weboptimizercache",
    "enableTagHelperBundling": true,
    "allowEmptyBundle": true
  }

make sure your .scss files have the correct import paths defined. To be able to analyse what's going wrong, you can replicate only the WebOptimizer.Sass project in your solution and debug it. It will help a lot!

@EmilAlipiev
Copy link

@HybridSolutions thanks for your reply. i have tried with simple test project but somehow i couldnt get it working. is my appsettings.json required or optional? you can check the other issue here. i tried a simple repro #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants