예제 #1
0
        private void BeforeQueryStatus(object sender, EventArgs e)
        {
            var button = (OleMenuCommand)sender;
            var items  = ProjectHelpers.GetSelectedItems();

            button.Visible = false;

            if (items.Count() != 1)
            {
                return;
            }

            var item = items.FirstOrDefault();

            if (item == null || item.ContainingProject == null || item.Properties == null)
            {
                return;
            }

            var sourceFile = item.Properties.Item("FullPath").Value.ToString();

            if (!WebCompiler.CompilerService.IsSupported(sourceFile))
            {
                return;
            }

            string configFile = item.ContainingProject.GetConfigFile();

            _configs = ConfigFileProcessor.IsFileConfigured(configFile, sourceFile);

            button.Visible = _configs != null && _configs.Any();
        }
예제 #2
0
        public void ShouldAppendMinOnlyOnce()
        {
            var configPath = Path.Combine(processingConfigFile, "outputfilemin.json");
            var configs    = ConfigHandler.GetConfigs(configPath);
            var outputFile = configs.First().OutputFile;

            // Capture the name of the resulting (minified) file.
            string resultFile = string.Empty;

            FileMinifier.BeforeWritingMinFile += (object sender, MinifyFileEventArgs e) => { resultFile = new FileInfo(e.ResultFile).Name; };

            ConfigFileProcessor processor = new ConfigFileProcessor();
            var results = processor.Process(configPath, configs, force: true);

            Assert.AreEqual(outputFile, resultFile);
        }
예제 #3
0
        private void BeforeQueryStatus(object sender, EventArgs e)
        {
            var button = (OleMenuCommand)sender;

            button.Visible = button.Enabled = false;

            _item = GetProjectItem(WebCompilerPackage._dte);
            _reCompileConfigs.Clear();

            if (_item == null || _item.ContainingProject == null || _item.Properties == null)
            {
                return;
            }

            string configFile = _item.ContainingProject.GetConfigFile();
            string inputFile  = _item.Properties.Item("FullPath").Value.ToString();

            button.Visible = button.Enabled = WebCompiler.CompilerService.IsSupported(inputFile);

            if (!button.Visible)
            {
                return;
            }

            var configs = ConfigFileProcessor.IsFileConfigured(configFile, inputFile);

            if (configs != null && configs.Any())
            {
                button.Text = "Re-compile file";
                _reCompileConfigs.AddRange(configs);
            }
            else
            {
                button.Text = "Compile file";
            }
        }
예제 #4
0
 public void Setup()
 {
     Telemetry.Enabled = false;
     _processor        = new ConfigFileProcessor();
 }
예제 #5
0
 public void Setup()
 {
     _processor = new ConfigFileProcessor();
 }