Esempio n. 1
13
 public string CompressContent(string content)
 {
     var minifier = new Minifier();
     if (settings != null)
     {
         return minifier.MinifyStyleSheet(content, settings);
     }
     return minifier.MinifyStyleSheet(content);
 }
Esempio n. 2
5
        public string Minify(string content)
        {
            var minifier = new Minifier();
            var stylesheet = string.Empty;

            stylesheet = Settings != null 
                ? minifier.MinifyStyleSheet(content, Settings) 
                : minifier.MinifyStyleSheet(content);

            return stylesheet;
        }
Esempio n. 3
0
        public static void ExtractCore(Translator translatorInstance, string outputPath, bool nodebug = false)
        {
            var clrPath = translatorInstance.BridgeLocation;
            var assembly = System.Reflection.Assembly.UnsafeLoadFrom(clrPath);

            // We can only have Beautified, Minified or Both, so this test has inverted logic:
            // output beautified if not minified only == (output beautified or output both)
            if (translatorInstance.AssemblyInfo.OutputFormatting != JavaScriptOutputType.Minified)
            {
                ExtractResourceAndWriteToFile(outputPath, assembly, "Bridge.Resources.bridge.js", "bridge.js");
            }

            if (translatorInstance.AssemblyInfo.GenerateTypeScript)
            {
                ExtractResourceAndWriteToFile(outputPath, assembly, "Bridge.Resources.bridge.d.ts", "bridge.d.ts");
            }

            // Like above test: output minified if not beautified only == (out minified or out both)
            if (translatorInstance.AssemblyInfo.OutputFormatting != JavaScriptOutputType.Formatted)
            {
                if (!nodebug)
                {
                    ExtractResourceAndWriteToFile(outputPath, assembly, "Bridge.Resources.bridge.js", "bridge.min.js", (reader) => { var minifier = new Minifier(); return minifier.MinifyJavaScript(reader.ReadToEnd(), new CodeSettings { TermSemicolons = true }); });
                }
            }
        }
Esempio n. 4
0
        public override IEnumerable<PvcCore.PvcStream> Execute(IEnumerable<PvcCore.PvcStream> inputStreams)
        {
            var minifyStreams = inputStreams.Where(x => Regex.IsMatch(x.StreamName, @"\.(js|css)$"));
            var resultStreams = new List<PvcStream>();

            foreach (var inputStream in minifyStreams)
            {
                var fileContent = new StreamReader(inputStream).ReadToEnd();
                var minifier = new Minifier();
                var resultContent = inputStream.StreamName.EndsWith(".js") ? minifier.MinifyJavaScript(fileContent) : minifier.MinifyStyleSheet(fileContent);

                foreach (var error in minifier.ErrorList)
                {
                    Console.Error.WriteLine(error.ToString());
                }

                var dirName = Path.GetDirectoryName(inputStream.StreamName);
                var fileName = Path.GetFileNameWithoutExtension(inputStream.StreamName) + ".min" + Path.GetExtension(inputStream.StreamName);

                var resultStream = PvcUtil.StringToStream(resultContent, Path.Combine(dirName, fileName));
                resultStreams.Add(resultStream);
            }

            return inputStreams.Where(x => !minifyStreams.Any(y => y.StreamName == x.StreamName)).Concat(resultStreams);
        }
Esempio n. 5
0
 public MinifierManager(CommandLineOptions cmdLineOptions)
     : base(cmdLineOptions)
 {
     _minifier = new Minifier();
     SetupDependencies();
     StartListener();
 }
        public string Compile(IEnumerable<string> files)
        {
            var blocks = new List<Block>();
            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (string file in files)
            {
                var parser = new JSParser(File.ReadAllText(file)) { FileContext = file };
                var block = parser.Parse(new CodeSettings
                {
                    EvalTreatment = EvalTreatment.MakeImmediateSafe,
                    PreserveImportantComments = false
                });
                if (block != null)
                {
                    blocks.Add(block);
                }
            }

            Block fst = blocks[0];
            for (int i = 1; i < blocks.Count; i++)
            {
                fst.Append(blocks[i]);
            }

            string sequenceCode = fst.ToCode();
            var minifier = new Minifier();
            string compiled = minifier.MinifyJavaScript(
                sequenceCode,
                new CodeSettings
                {
                    EvalTreatment = EvalTreatment.MakeImmediateSafe,
                    PreserveImportantComments = false
                });
            return compiled;
        }
    /// <summary>
    /// Minifies the specified CSS.
    /// </summary>
    /// <param name="resource">The CSS to minify.</param>
    /// <returns>The minified CSS, if minification was successful; otherwise, the original CSS with minification errors appended at the end.</returns>
    public string Minify(string resource)
    {
        if (String.IsNullOrEmpty(resource))
        {
            return resource;
        }

        var settings = new CssSettings
        {
            AllowEmbeddedAspNetBlocks = false
        };
        var minifier = new Minifier();
        try
        {
            resource = minifier.MinifyStyleSheet(resource, settings);
        }
        catch
        {
            var minificationErrors = String.Join(Environment.NewLine, minifier.Errors);
            resource = AppendMinificationErrors(resource, minificationErrors);

            if (mLogErrors)
            {
                CoreServices.EventLog.LogEvent("W", "Resource minification", "CssMinificationFailed", minificationErrors);
            }
        }

        return resource;
    }
        private static void MinifyFile(string file, string minFile, CodeSettings settings, bool isBundle)
        {
            Minifier minifier = new Minifier();

            if (!isBundle)
            {
                minifier.FileName = Path.GetFileName(file);
            }

            string content = minifier.MinifyJavaScript(File.ReadAllText(file), settings);

            if (File.Exists(minFile) && content == File.ReadAllText(minFile))
                return;

            if (WESettings.GetBoolean(WESettings.Keys.GenerateJavaScriptSourceMaps))
            {
                content += "\r\n/*\r\n//# sourceMappingURL=" + Path.GetFileName(minFile) + ".map\r\n*/";
            }

            ProjectHelpers.CheckOutFileFromSourceControl(minFile);
            using (StreamWriter writer = new StreamWriter(minFile, false, new UTF8Encoding(true)))
            {
                writer.Write(content);
            }

            if (WESettings.GetBoolean(WESettings.Keys.JavaScriptEnableGzipping))
                CssSaveListener.GzipFile(file, minFile, content);
        }
Esempio n. 9
0
        private static MinificationResult MinifyJavaScript(Config config, string file)
        {
            string content = File.ReadAllText(file);
            var settings = JavaScriptOptions.GetSettings(config);

            if (config.Minify.ContainsKey("enabled") && config.Minify["enabled"].ToString().Equals("false", StringComparison.OrdinalIgnoreCase))
                return null;

            var minifier = new Minifier();

            string ext = Path.GetExtension(file);
            string minFile = file.Substring(0, file.LastIndexOf(ext)) + ".min" + ext;
            string mapFile = minFile + ".map";

            string result = minifier.MinifyJavaScript(content, settings);

            bool containsChanges = FileHelpers.HasFileContentChanged(minFile, result);

            if (!string.IsNullOrEmpty(result))
            {
                OnBeforeWritingMinFile(file, minFile, containsChanges);

                if (containsChanges)
                {
                    File.WriteAllText(minFile, result, new UTF8Encoding(true));
                }

                OnAfterWritingMinFile(file, minFile, containsChanges);

                GzipFile(config, minFile, containsChanges);
            }

            return new MinificationResult(result, null);
        }
Esempio n. 10
0
        private static MinificationResult MinifyCss(Config config, string file)
        {
            string content = File.ReadAllText(file);
            var settings = CssOptions.GetSettings(config);

            if (config.Minify.ContainsKey("enabled") && config.Minify["enabled"].ToString().Equals("false", StringComparison.OrdinalIgnoreCase))
                return null;

            var minifier = new Minifier();

            // Remove control characters which AjaxMin can't handle
            content = Regex.Replace(content, @"[\u0000-\u0009\u000B-\u000C\u000E-\u001F]", string.Empty);

            string result = minifier.MinifyStyleSheet(content, settings);
            string minFile = GetMinFileName(file);
            bool containsChanges = FileHelpers.HasFileContentChanged(minFile, result);

            OnBeforeWritingMinFile(file, minFile, containsChanges);

            if (containsChanges)
            {
                File.WriteAllText(minFile, result, new UTF8Encoding(true));
            }

            OnAfterWritingMinFile(file, minFile, containsChanges);

            GzipFile(config, minFile, containsChanges);

            return new MinificationResult(result, null);
        }
Esempio n. 11
0
        public static string MinifyString(string extension, string content)
        {
            if (extension == ".css")
            {
                Minifier minifier = new Minifier();
                CssSettings settings = new CssSettings();
                settings.CommentMode = CssComment.None;

                if (WESettings.GetBoolean(WESettings.Keys.KeepImportantComments))
                {
                    settings.CommentMode = CssComment.Important;
                }

                return minifier.MinifyStyleSheet(content, settings);
            }
            else if (extension == ".js")
            {
                Minifier minifier = new Minifier();
                CodeSettings settings = new CodeSettings()
                {
                    EvalTreatment = EvalTreatment.MakeImmediateSafe,
                    PreserveImportantComments = WESettings.GetBoolean(WESettings.Keys.KeepImportantComments)
                };

                return minifier.MinifyJavaScript(content, settings);
            }

            return null;
        }
Esempio n. 12
0
        protected override void BuildResult(Stream fs, List <string> filePaths)
        {
            var minifier = new Microsoft.Ajax.Utilities.Minifier();

            minifier.WarningLevel = 3;
            var styleBuilder = new StringBuilder();

            foreach (var style in filePaths)
            {
                var text = FileOperator.ReadAllText(style);
                try
                {
                    var mintext = minifier.MinifyStyleSheet(text);
                    if (minifier.Errors.Count == 0)
                    {
                        text = mintext;
                    }
                }
                catch (Exception)
                {
                }
                styleBuilder.AppendLine(text);
            }
            var buffer = Encoding.UTF8.GetBytes(styleBuilder.ToString());

            fs.Write(buffer, 0, buffer.Length);
        }
Esempio n. 13
0
        protected override void BuildResult(Stream fs, List <string> filePaths)
        {
            var minifier = new Microsoft.Ajax.Utilities.Minifier();

            minifier.WarningLevel = 3;
            var styleBuilder = new StringBuilder();


            foreach (var style in filePaths)
            {
                var text = FileOperator.ReadAllText(style);
                if (style.IndexOf(".min.") == -1)
                {
                    try
                    {
                        var mintext = minifier.MinifyJavaScript(text);
                        text = mintext;
                    }
                    catch (Exception)
                    {
                    }
                }
                styleBuilder.Append(';');
                styleBuilder.AppendLine(text);
            }
            var buffer = Encoding.UTF8.GetBytes(styleBuilder.ToString());

            fs.Write(buffer, 0, buffer.Length);
        }
Esempio n. 14
0
        public string Minify(string content)
        {
            var minifer = new Minifier();
            codeSettings = codeSettings ?? new CodeSettings();
            codeSettings.SetKnownGlobalNames(globalNames);

            return minifer.MinifyJavaScript(content, codeSettings);
        }
Esempio n. 15
0
	    /// <summary>
	    /// (Awaitable) Compiles content with the give configuration (files and minify flag).
	    /// </summary>
	    /// <param name="content">Content to Compile</param>
	    /// <param name="minify"></param>
	    /// <returns>string with compiled content</returns>
	    public Task<string> CompileAsync(string content, bool minify)
	    {
	        if (!minify)
	            return Task.FromResult(content);

			var minifier = new Minifier();
			return Task.FromResult(minifier.MinifyJavaScript(content));
		}
Esempio n. 16
0
 /// <summary>
 /// Minifies the CSS.
 /// </summary>
 /// <param name="css">The CSS.</param>
 /// <returns></returns>
 public static String MinifyCss(String css)
 {
     if (String.IsNullOrWhiteSpace(css))
         return css;
     var min = new Minifier();
     return min.MinifyStyleSheet(css);
     //return Yahoo.Yui.Compressor.CssCompressor.Compress(css);
 }
Esempio n. 17
0
        public string CompressContent(string content, bool removeComments)
        {
            var settings = new CssSettings();
            if(removeComments)
                settings.CommentMode = CssComment.None;

            var minifier = new Minifier();
            return minifier.MinifyStyleSheet(content, settings);
        }
        public string Compress(string content)
        {
            var cssSettings = new CssSettings();
            cssSettings.ColorNames = CssColor.Hex;
            cssSettings.ExpandOutput = false;

            var value = new Minifier().MinifyStyleSheet(content, cssSettings);
            return value;
        }
Esempio n. 19
0
        public void Minify()
        {
            var minifer = new Minifier();
            var codeSettings = new CodeSettings();

            var content = _fileSystem.BundleFiles(_files);
            var minified =  minifer.MinifyJavaScript(content, codeSettings);

            _fileSystem.File.WriteAllText(_outputPath, minified);
        }
Esempio n. 20
0
 protected override string Compress(string source)
 {
     var minifier = new Minifier();
     var minified = minifier.MinifyJavaScript(source);
     if (minifier.Errors.Count > 0)
     {
         return source;
     }
     return minified;
 }
Esempio n. 21
0
 public string Minify(string source)
 {
     CodeSettings settings = new CodeSettings
     {
         PreserveImportantComments = false,
         PreserveFunctionNames = true
     };
     Minifier doMin = new Minifier();
     string mind = doMin.MinifyJavaScript(source, settings);
     return mind;
 }
Esempio n. 22
0
 private static void Generate(string outputPath, bool minify, Minifier minifier, string js)
 {
     if (minify)
     {
         File.WriteAllText(outputPath, minifier.MinifyJavaScript(js));
     }
     else
     {
         File.WriteAllText(outputPath, js);
     }
 }
 public Func<Stream> Transform(Func<Stream> openSourceStream, IAsset asset)
 {
     return delegate
     {
         using (var reader = new StreamReader(openSourceStream()))
         {
             var output = new Minifier().MinifyStyleSheet(reader.ReadToEnd(), cssSettings);
             return output.AsStream();
         }
     };
 }
Esempio n. 24
0
 public string CompressContent(string content)
 {
     var minifer = new Minifier();
     if (codeSettings != null)
     {
         return minifer.MinifyJavaScript(content, codeSettings, globalNames);
     }
     else
     {
         return minifer.MinifyJavaScript(content, globalNames);
     }
 }
        public override void Process(BundleContext context, BundleResponse response)
        {
            response.ContentType = ContentType.JavaScript;

            if (context.HttpContext.IsDebuggingEnabled)
            {
                return;
            }

            var minifier = new Minifier();
            response.Content = minifier.MinifyJavaScript(response.Content);
        }
Esempio n. 26
0
        public void Write(Module module)
        {
            var minifier = new Minifier();

            textWriter.Write(
                minifier.MinifyJavaScript(
                    string.Join(
                        "\r\n",
                        module.Resources.Select(s => GetJavaScript(rootDirectory + s.Path))
                    )
                )
            );
        }
        public void Write(Module module)
        {
            var minifier = new Minifier();

            textWriter.Write(
                minifier.MinifyStyleSheet(
                    string.Join(
                        "\r\n",
                        module.Resources.Select(ReadCss)
                    )
                )
            );
        }
Esempio n. 28
0
        public void ProcessRequest(HttpContext context)
        {
            _context = context;

            Map("~/Client/routes/", BuildName);
            Map("~/Client/controls/", file => String.Format("controls/{0}", Path.GetFileNameWithoutExtension(file)));

            var minifier = new Minifier();
            context.Response.ContentType = "text/javascript";
            var content = minifier.MinifyJavaScript(_builder.ToString());
            context.Response.Write(minifier.ErrorList.Any() ? _builder.ToString() : content);
            context.Response.End();
        }
Esempio n. 29
0
        static void Main(string[] args)
        {
            bool minify = false;
            bool absolute = false;

            if (args.Length < 1)
            {
                Console.WriteLine("Usage: {0} [url] (/minify) (/absolute)", typeof(Program).Assembly.GetName().Name);
                return;
            }

            ParseArguments(args, out minify, out absolute);

            string url = args[0];
            string baseUrl = null;
            if (!url.EndsWith("/"))
            {
                url += "/";
            }

            if(!url.EndsWith("signalr"))
            {
                url += "signalr/";
            }

            baseUrl = url;
            if (!url.EndsWith("hubs", StringComparison.OrdinalIgnoreCase))
            {
                url += "hubs";
            }

            var uri = new Uri(url);

            var minifier = new Minifier();
            var wc = new WebClient();
            string js = wc.DownloadString(uri);
            if (absolute)
            {
                js = Regex.Replace(js, @"\(""(.*?/signalr)""\)", m => "(\"" + baseUrl + "\")");
            }

            if (minify)
            {
                Console.WriteLine(minifier.MinifyJavaScript(js));
            }
            else
            {
                Console.WriteLine(js);
            }
        }
Esempio n. 30
0
        public static string MinifyString(string extension, string content)
        {
            if (extension == ".css")
            {
                Minifier minifier = new Minifier();
                CssSettings settings = new CssSettings();
                settings.CommentMode = CssComment.None;

                if (WESettings.GetBoolean(WESettings.Keys.KeepImportantComments))
                {
                    settings.CommentMode = CssComment.Important;
                }

                return minifier.MinifyStyleSheet(content, settings);
            }
            else if (extension == ".js")
            {
                Minifier minifier = new Minifier();
                CodeSettings settings = new CodeSettings()
                {
                    EvalTreatment = EvalTreatment.MakeImmediateSafe,
                    PreserveImportantComments = WESettings.GetBoolean(WESettings.Keys.KeepImportantComments)
                };

                return minifier.MinifyJavaScript(content, settings);
            }
            else if (_htmlExt.Contains(extension.ToLowerInvariant())){
                var settings = new HtmlMinificationSettings
                {
                    RemoveOptionalEndTags = false,
                    AttributeQuotesRemovalMode = HtmlAttributeQuotesRemovalMode.KeepQuotes
                };

                var minifier = new HtmlMinifier(settings);
                MarkupMinificationResult result = minifier.Minify(content, generateStatistics: true);

                if (result.Errors.Count == 0)
                {
                    EditorExtensionsPackage.DTE.StatusBar.Text = "Web Essentials: HTML minified by " + result.Statistics.SavedInPercent + "%";
                    return result.MinifiedContent;
                }
                else
                {
                    EditorExtensionsPackage.DTE.StatusBar.Text = "Web Essentials: Cannot minify the current selection";
                    return content;
                }
            }

            return null;
        }
        /// <summary>
        /// Compressed the javascript content
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public string Compress(string content)
        {
            // The CodeSettings object specifies how the content
            // will be minified
            var codeSettings = new CodeSettings();
            codeSettings.RemoveUnneededCode = true;
            codeSettings.LocalRenaming = LocalRenaming.CrunchAll;
            codeSettings.OutputMode = OutputMode.SingleLine;
            codeSettings.StripDebugStatements = true;
            codeSettings.IndentSize = 0;

            var value = new Minifier().MinifyJavaScript(content, codeSettings);
            return value;
        }
Esempio n. 32
0
        private static string MinifyJavaScript(string input)
        {
            Minifier minifier = new Minifier();
            CodeSettings settings = new CodeSettings();
            settings.RemoveUnneededCode = false;
            settings.PreserveFunctionNames = true;

            string output = minifier.MinifyJavaScript(input, settings);
            if (!String.IsNullOrEmpty(output))
            {
                output = output + ";";
            }

            return output;
        }
Esempio n. 33
0
        private void minifyCSS(Entity entity, CssSettings settings)
        {
            Microsoft.Ajax.Utilities.Minifier minifier = new Microsoft.Ajax.Utilities.Minifier();
            string name = entity.GetAttributeValue <string>("displayname");

            byte[] cssFileBytes = Convert.FromBase64String(entity.GetAttributeValue <string>("content"));
            string originalCss  = UnicodeEncoding.UTF8.GetString(cssFileBytes);
            string minifiedCss  = minifier.MinifyStyleSheet(originalCss, settings);

            byte[] minifiedCssBytes       = UnicodeEncoding.UTF8.GetBytes(minifiedCss);
            string minifiedCssBytesString = Convert.ToBase64String(minifiedCssBytes);
            Entity updatedWebResource     = new Entity(entity.LogicalName);

            updatedWebResource.Attributes.Add("content", minifiedCssBytesString);
            updatedWebResource.Id = entity.Id;
            this.service.Update(updatedWebResource);
        }
        /// <summary>
        /// Main Method (Entry point to the program).
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            /// instantiate a code settings object.
            CodeSettings cs = new CodeSettings();

            cs.QuoteObjectLiteralProperties = true;
            cs.PreserveImportantComments    = false;

            /// Extract the bookmarklet wrapper javascript from the js wrapper file.
            /// This file is the defines the bookmarklet javascript entry point and wraps each bookmarklet within this javascript.
            string bookmarkletMainJSWrapper = System.IO.File.ReadAllText(Properties.Settings.Default.BookmarkletMainJSWrapper);

            /// Read all the HTML Template file for adding the bookmarklets as links into.
            string htmlTemplate = System.IO.File.ReadAllText(Properties.Settings.Default.BookmarkletHtmlTemplate);

            string importableTemplate = System.IO.File.ReadAllText(Properties.Settings.Default.BookmarkletHtmlImportableTemplate);

            /// A list of all the bookarklets from the bookmarklets folder
            List <Bookmarklet> bookmarklets = new List <Bookmarklet>();

            #region Load all bookmarklets
            /// For each bookmarklet js in the bookmarklets folder
            foreach (string file in System.IO.Directory.GetFiles(Properties.Settings.Default.BookmarkletsFolder))
            {
                /// get the file info
                FileInfo fi = new FileInfo(file);

                // if the file is not a js file skip
                if (fi.Extension.ToLower() != ".js")
                {
                    continue;
                }

                /// Instantite the bookmarklet object populating all the properties
                Bookmarklet bookmarklet = new Bookmarklet();

                bookmarklet.Name = fi.Name.Replace(".js", "");

                bookmarklet.javascript = System.IO.File.ReadAllText(file);


                /// Extract the bookmarklet info from the xml documentation notation
                int firstIndex = bookmarklet.javascript.IndexOf("<BookmarkletInfo>");
                int lastindex  = bookmarklet.javascript.LastIndexOf("</BookmarkletInfo>") + ("</BookmarkletInfo>").Length;
                if (firstIndex > 0)
                {
                    string    bookmarkletInfo = bookmarklet.javascript.Substring(firstIndex, lastindex - firstIndex);
                    XDocument doc             = XDocument.Parse(bookmarkletInfo);
                    var       nameNode        = doc.XPathSelectElement("/BookmarkletInfo/Name");
                    if (nameNode != null)
                    {
                        bookmarklet.Name = nameNode.Value.ToString().Trim();
                    }

                    var descriptionNode = doc.XPathSelectElement("/BookmarkletInfo/Description");
                    if (descriptionNode != null)
                    {
                        bookmarklet.Description = InnerXml(descriptionNode).Trim();
                    }
                }
                /// update the bookmarklet javascript by inserting it into the main wrapper js
                /// witha  replace of "//[[Bookmarklet-Code-Inserted-Here]]" with the bookmarklet javascript
                bookmarklet.javascript = bookmarkletMainJSWrapper.Replace("//[[Bookmarklet-Code-Inserted-Here]]", bookmarklet.javascript);

                // add it to the list of bookmarklets.
                bookmarklets.Add(bookmarklet);
            }

            #endregion Load all bookmarklets


            #region output all bookmarklets into the html output file based on the template.
            string bookmarkletHtml   = "";
            string bookmarkletImport = "";
            ///Instantiate a minifer instance
            Minifier minifier = new Microsoft.Ajax.Utilities.Minifier();

            foreach (var bookmarklet in bookmarklets)
            {
                //bookmarkletHtml += "<a href='javascript:" + HttpUtility.JavaScriptStringEncode(jsMinifer.Compress(kvp.Value)) + "'>" + kvp.Key + "</a>" + Environment.NewLine;
                bookmarkletHtml += "<p>";
                /// append the bookmarklet js minified.  Replace all ' with \\' to escape any js quotes.
                bookmarkletHtml += "<a href=\"javascript:" + minifier.MinifyJavaScript(bookmarklet.javascript, cs).Replace("'", "\\'").Replace("\"", "'") + "\">" + bookmarklet.Name + "</a>" + Environment.NewLine;
                if (!string.IsNullOrEmpty(bookmarklet.Description))
                {
                    bookmarkletHtml += "<br/>";
                    bookmarkletHtml += bookmarklet.Description;
                }
                bookmarkletHtml += "</p>";

                /// append the bookmarklet js minified.  Replace all ' with \\' to escape any js quotes.
                bookmarkletImport += "\t\t<DT><A HREF=\"javascript:" + minifier.MinifyJavaScript(bookmarklet.javascript, cs).Replace("'", "\\'").Replace("\"", "'") + "\">" + bookmarklet.Name + "</A>" + Environment.NewLine;
            }

            string html = htmlTemplate.Replace("<!--Bookmarklets-->", bookmarkletHtml);
            /// write the results to the html output file
            File.WriteAllText(Properties.Settings.Default.BookmarkletHtmlOutput, html);

            html = importableTemplate.Replace("<!--Bookmarklets-->", bookmarkletImport);
            /// write the results to the html output file
            File.WriteAllText(Properties.Settings.Default.BookmarkletImportOutput, html);

            #endregion output all bookmarklets into the html output file based on the template.
        }