Exemple #1
0
        private async void SolutionEvents_Opened()
        {
            foreach (Project project in ProjectHelpers.GetAllProjects())
            {
                if (project.ProjectItems.Count == 0)
                {
                    continue;
                }

                string folder = ProjectHelpers.GetRootFolder(project);
                Func <string, bool, Task> bundleFunc = new BundleFilesMenu().UpdateBundleAsync;
                Func <string, bool, Task> spriteFunc = new SpriteImageMenu().UpdateSpriteAsync;

                foreach (string file in Directory.EnumerateFiles(folder, "*.*", SearchOption.AllDirectories)
                         .Where(s => s.EndsWith(".bundle") || s.EndsWith(".sprite")))
                {
                    if (ProjectHelpers.GetProjectItem(file) == null)
                    {
                        continue;
                    }

                    if (file.EndsWith(".bundle", StringComparison.OrdinalIgnoreCase))
                    {
                        await BundleGenerator.WatchFiles(await BundleDocument.FromFile(file), bundleFunc);
                    }
                    else
                    {
                        await SpriteGenerator.WatchFiles(await SpriteDocument.FromFile(file), spriteFunc);
                    }
                }
            }
        }
        private async void SolutionEvents_Opened()
        {
            foreach (Project project in ProjectHelpers.GetAllProjects())
            {
                if (project.ProjectItems.Count == 0)
                    continue;

                string folder = ProjectHelpers.GetRootFolder(project);

                if (string.IsNullOrEmpty(folder))
                    continue;

                Func<string, bool, Task> bundleFunc = new BundleFilesMenu().UpdateBundleAsync;
                Func<string, bool, Task> spriteFunc = new SpriteImageMenu().UpdateSpriteAsync;

                BundleFileObserver observer = new BundleFileObserver();

                observer.WatchFutureFiles(folder, "*.bundle", async (s) => { await BundleGenerator.WatchFiles(await BundleDocument.FromFile(s), bundleFunc); });
                observer.WatchFutureFiles(folder, "*.sprite", async (s) => { await SpriteGenerator.WatchFiles(await SpriteDocument.FromFile(s), spriteFunc); });

                foreach (string file in Directory.EnumerateFiles(folder, "*.*", SearchOption.AllDirectories)
                                       .Where(s => s.EndsWith(".bundle") || s.EndsWith(".sprite")))
                {
                    if (ProjectHelpers.GetProjectItem(file) == null)
                        continue;

                    if (file.EndsWith(".bundle", StringComparison.OrdinalIgnoreCase))
                        await BundleGenerator.WatchFiles(await BundleDocument.FromFile(file), bundleFunc);
                    else
                        await SpriteGenerator.WatchFiles(await SpriteDocument.FromFile(file), spriteFunc);
                }
            }
        }
        public static async Task UpdateAllBundlesAsync(bool isBuild = false)
        {
            foreach (Project project in ProjectHelpers.GetAllProjects())
            {
                if (project.ProjectItems.Count == 0)
                {
                    continue;
                }

                string folder = ProjectHelpers.GetRootFolder(project);

                if (string.IsNullOrEmpty(folder))
                {
                    continue;
                }

                BundleFilesMenu menu = new BundleFilesMenu();

                foreach (string file in Directory.EnumerateFiles(folder, "*" + _ext, SearchOption.AllDirectories))
                {
                    if (ProjectHelpers.GetProjectItem(file) == null)
                    {
                        continue;
                    }

                    await menu.UpdateBundleAsync(file, isBuild);
                }
            }
        }
Exemple #4
0
        protected override void Initialize()
        {
            base.Initialize();
            Instance = this;
            JsDocComments.Register();

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                HandleMenuVisibility(mcs);

                TransformMenu transform = new TransformMenu(DTE, mcs);
                transform.SetupCommands();

                DiffMenu diffMenu = new DiffMenu(DTE, mcs);
                diffMenu.SetupCommands();

                MinifyFileMenu minifyMenu = new MinifyFileMenu(DTE, mcs);
                minifyMenu.SetupCommands();

                BundleFilesMenu bundleMenu = new BundleFilesMenu(DTE, mcs);
                bundleMenu.SetupCommands();

                JsHintMenu jsHintMenu = new JsHintMenu(DTE, mcs);
                jsHintMenu.SetupCommands();

                ProjectSettingsMenu projectSettingsMenu = new ProjectSettingsMenu(DTE, mcs);
                projectSettingsMenu.SetupCommands();

                SolutionColorsMenu solutionColorsMenu = new SolutionColorsMenu(DTE, mcs);
                solutionColorsMenu.SetupCommands();

                BuildMenu buildMenu = new BuildMenu(DTE, mcs);
                buildMenu.SetupCommands();

                MarkdownStylesheetMenu markdownMenu = new MarkdownStylesheetMenu(DTE, mcs);
                markdownMenu.SetupCommands();
            }

            // Hook up event handlers
            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                DTE.Events.BuildEvents.OnBuildDone     += BuildEvents_OnBuildDone;
                DTE.Events.SolutionEvents.Opened       += delegate { Settings.UpdateCache(); Settings.UpdateStatusBar("applied"); };
                DTE.Events.SolutionEvents.AfterClosing += delegate { DTE.StatusBar.Clear(); };
            }), DispatcherPriority.ApplicationIdle, null);
        }
Exemple #5
0
        private static void InitiateExecutors()
        {
            var compiler = WebEditor.Host.ExportProvider.GetExport <ProjectCompiler>();

            Task.Run(async() =>
            {
                Parallel.ForEach(
                    Mef.GetSupportedContentTypes <ICompilerRunnerProvider>()
                    .Where(c => WESettings.Instance.ForContentType <ICompilerInvocationSettings>(c).CompileOnBuild),
                    c => compiler.Value.CompileSolutionAsync(c).DoNotWait("compiling solution-wide " + c.DisplayName)
                    );

                await BuildMenu.UpdateBundleFiles();
            }).DoNotWait("running solution-wide compilers");

            if (WESettings.Instance.JavaScript.LintOnBuild)
            {
                LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.js" }, f => new JavaScriptLintReporter(new JsHintCompiler(), f))
                .DoNotWait("running solution-wide JSHint");
                LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.js" }, f => new JavaScriptLintReporter(new JsCodeStyleCompiler(), f))
                .DoNotWait("running solution-wide JSCS");
            }

            if (WESettings.Instance.TypeScript.LintOnBuild)
            {
                LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.ts" }, f => new LintReporter(new TsLintCompiler(), WESettings.Instance.TypeScript, f))
                .DoNotWait("running solution-wide TSLint");
            }

            if (WESettings.Instance.CoffeeScript.LintOnBuild)
            {
                LintFileInvoker.RunOnAllFilesInProjectAsync(new[] { "*.coffee", "*.iced" }, f => new LintReporter(new CoffeeLintCompiler(), WESettings.Instance.CoffeeScript, f))
                .DoNotWait("running solution-wide CoffeeLint");
            }

            BundleFilesMenu.UpdateAllBundlesAsync(true).DoNotWait("running bundles");
            SpriteImageMenu.UpdateAllSpritesAsync(true).DoNotWait("running sprites");
        }
Exemple #6
0
        protected async override void Initialize()
        {
            base.Initialize();

            Instance = this;

            await NodeServer.Up();

            SettingsStore.Load();
            JavaScriptIntellisense.Register();

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                TransformMenu           transform           = new TransformMenu(DTE, mcs);
                DiffMenu                diffMenu            = new DiffMenu(mcs);
                MinifyFileMenu          minifyMenu          = new MinifyFileMenu(mcs);
                BundleFilesMenu         bundleMenu          = new BundleFilesMenu(DTE, mcs);
                JsHintMenu              jsHintMenu          = new JsHintMenu(DTE, mcs);
                TsLintMenu              tsLintMenu          = new TsLintMenu(DTE, mcs);
                HubsT4Menu              hubsT4Menu          = new HubsT4Menu(DTE, mcs);
                CoffeeLintMenu          coffeeLintMenu      = new CoffeeLintMenu(DTE, mcs);
                JsCodeStyle             jsCodeStyleMenu     = new JsCodeStyle(DTE, mcs);
                RtlCssMenu              rtlCssMenu          = new RtlCssMenu(DTE, mcs);
                CsonMenu                cson                = new CsonMenu(mcs);
                ProjectSettingsMenu     projectSettingsMenu = new ProjectSettingsMenu(DTE, mcs);
                SolutionColorsMenu      solutionColorsMenu  = new SolutionColorsMenu(mcs);
                BuildMenu               buildMenu           = new BuildMenu(DTE, mcs);
                MarkdownMenu            markdownMenu        = new MarkdownMenu(DTE, mcs);
                HandlebarsMenu          handlebarsMenu      = new HandlebarsMenu(DTE, mcs);
                AddIntellisenseFileMenu intellisenseFile    = new AddIntellisenseFileMenu(DTE, mcs);
                UnusedCssMenu           unusedCssMenu       = new UnusedCssMenu(mcs);
                PixelPushingMenu        pixelPushingMenu    = new PixelPushingMenu(mcs);
                ReferenceJsMenu         referenceJsMenu     = new ReferenceJsMenu(mcs);
                CompressImageMenu       compressImageMenu   = new CompressImageMenu(mcs);
                SpriteImageMenu         spriteImageMenu     = new SpriteImageMenu(DTE, mcs);
                UnminifyMenu            unMinifyMenu        = new UnminifyMenu(mcs);
                //ChainCompilationMenu chainCompilationMenu = new ChainCompilationMenu(DTE, mcs);

                HandleMenuVisibility(mcs);
                referenceJsMenu.SetupCommands();
                pixelPushingMenu.SetupCommands();
                unusedCssMenu.SetupCommands();
                intellisenseFile.SetupCommands();
                markdownMenu.SetupCommands();
                handlebarsMenu.SetupCommands();
                buildMenu.SetupCommands();
                solutionColorsMenu.SetupCommands();
                projectSettingsMenu.SetupCommands();
                jsHintMenu.SetupCommands();
                tsLintMenu.SetupCommands();
                hubsT4Menu.SetupCommands();
                coffeeLintMenu.SetupCommands();
                jsCodeStyleMenu.SetupCommands();
                rtlCssMenu.SetupCommands();
                cson.SetupCommands();
                bundleMenu.SetupCommands();
                minifyMenu.SetupCommands();
                diffMenu.SetupCommands();
                transform.SetupCommands();
                compressImageMenu.SetupCommands();
                spriteImageMenu.SetupCommands();
                unMinifyMenu.SetupCommands();
                //chainCompilationMenu.SetupCommands();
            }

            IconRegistration.RegisterIcons();

            // Hook up event handlers
            await Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                DTE.Events.BuildEvents.OnBuildDone += BuildEvents_OnBuildDone;
                DTE.Events.SolutionEvents.Opened += delegate { SettingsStore.Load(); ShowTopMenu(); };
                DTE.Events.SolutionEvents.AfterClosing += delegate { DTE.StatusBar.Clear(); ShowTopMenu(); };
            }), DispatcherPriority.ApplicationIdle, null);
        }
Exemple #7
0
 private static void RunBundles()
 {
     BundleFilesMenu.UpdateAllBundlesAsync(true).DoNotWait("Web Essentials: Updating Bundles...");
     SpriteImageMenu.UpdateAllSpritesAsync(true).DoNotWait("Web Essentials: Updating Sprites...");
 }
        public static async Task UpdateAllBundlesAsync(bool isBuild = false)
        {
            foreach (Project project in ProjectHelpers.GetAllProjects())
            {
                if (project.ProjectItems.Count == 0)
                    continue;

                string folder = ProjectHelpers.GetRootFolder(project);

                BundleFilesMenu menu = new BundleFilesMenu();

                foreach (string file in Directory.EnumerateFiles(folder, "*" + _ext, SearchOption.AllDirectories))
                {
                    if (ProjectHelpers.GetProjectItem(file) == null)
                        continue;

                    await menu.UpdateBundleAsync(file, isBuild);
                }
            }
        }
Exemple #9
0
 private static void UpdateBundleFiles()
 {
     //Logger.Log("Updating bundles...");
     BundleFilesMenu.UpdateBundles(null, true);
     //Logger.Log("Bundles updated");
 }
 public async static Task UpdateBundleFiles()
 {
     await BundleFilesMenu.UpdateBundles(null, true);
 }
Exemple #11
0
 private async static Task UpdateBundleFiles()
 {
     await BundleFilesMenu.UpdateAllBundlesAsync();
 }
Exemple #12
0
 private void UpdateBundleFiles()
 {
     BundleFilesMenu.UpdateBundles(null, true);
 }
 public static void UpdateBundleFiles()
 {
     BundleFilesMenu.UpdateBundles(null, true);
 }
 void SolutionEvents_Opened()
 {
     System.Threading.Tasks.Task.Run(() => BundleFilesMenu.BindAllBundlesAssets(ProjectHelpers.GetSolutionFolderPath()));
 }