Taritsyn / BundleTransformer

Bundle Transformer - a modular extension for System.Web.Optimization (also known as the Microsoft ASP.NET Web Optimization Framework).
Apache License 2.0
130 stars 19 forks source link

SassAndScssTranslator does not compile @import files on save. #39

Closed imraymondlee closed 4 years ago

imraymondlee commented 4 years ago

I have a main .scss file called main.scss that contains multiple other .scss files using @import. I'm using BundleTransformer with the SassAndScssTranslator in my BundleConfig to compile and bundle main.scss file, which is working great as it automatically compiles the file when I save. The issue I am facing is that it only automatically compiles when I save the main.scss file and not when I save files that I have imported into main.scss. I can't seem to figure out what is causing this issue.

Taritsyn commented 4 years ago

Hello, Raymond!

In my case, there are no such problems in either release mode or debug mode.

Show me the code of your BundleConfig.cs file.

imraymondlee commented 4 years ago

Hi Taritsyn,

Here is my BundleConfig.cs

using BundleTransformer.Core.Bundles;
using BundleTransformer.Core.Orderers;
using BundleTransformer.Core.Resolvers;
using System.Web;
using System.Web.Optimization;

namespace SassTest
{
    public class BundleConfig
    {
        // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                       "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                       "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                       "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                     "~/Scripts/bootstrap.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                     "~/Content/bootstrap.css",
                     "~/Content/site.css"));

            BundleResolver.Current = new CustomBundleResolver();

            var nullBuilder = new NullBuilder();
            var nullOrderer = new NullOrderer();

            var sassStyleBundle = new CustomStyleBundle("~/dist/main");
            sassStyleBundle.Include(
                "~/Content/main.scss"
                );
            sassStyleBundle.Orderer = nullOrderer;
            bundles.Add(sassStyleBundle);
        }
    }
}
Taritsyn commented 4 years ago

Everything should work. Try to reproduce this error as a demo project and send me a link to it.

imraymondlee commented 4 years ago

I've created a new project, but could not seem to replicate the issue. Seems like it was something to do with the project itself. Thanks for your help!