Beispiel #1
0
        public JavascriptCompilerResult Compile(string source)
        {
            var result = NUglify.Uglify.Js(source);
            var javascriptCompilerResult = new JavascriptCompilerResult();

            foreach (var error in result.Errors)
            {
                javascriptCompilerResult.Errors.Add(error);
            }

            return(javascriptCompilerResult);
        }
Beispiel #2
0
        public JavascriptCompilerResult Compile(string source)
        {
            var results = _provider.CompileAssemblyFromSource(_parameters, source);
            var javascriptCompilerResult = new JavascriptCompilerResult();

            foreach (var error in results.Errors.Cast <CompilerError>().Where(error => !_ignoredRules.Contains(error.ErrorNumber)))
            {
                javascriptCompilerResult.Errors.Add(error);
            }

            return(javascriptCompilerResult);
        }
Beispiel #3
0
        /// <summary>
        /// Compiles the specified Javascript files.
        /// </summary>
        /// <param name="files">The absolute file paths to .js files.</param>
        public IDictionary <string, JavascriptCompilerResult> Compile(params string[] files)
        {
            var compilerResults = new Dictionary <string, JavascriptCompilerResult>();

            foreach (var file in files)
            {
                var source = File.ReadAllText(file);

                var result = NUglify.Uglify.Js(source);
                var javascriptCompilerResult = new JavascriptCompilerResult();

                foreach (var error in result.Errors)
                {
                    javascriptCompilerResult.Errors.Add(error);
                }

                compilerResults.Add(file, javascriptCompilerResult);
            }

            return(compilerResults);
        }
Beispiel #4
0
        /// <summary>
        /// Compiles the specified Javascript files.
        /// </summary>
        /// <param name="files">The absolute file paths to .js files.</param>
        public IDictionary <string, JavascriptCompilerResult> Compile(params string[] files)
        {
            var compilerResults = new Dictionary <string, JavascriptCompilerResult>();

            foreach (var file in files)
            {
                using (var reader = File.OpenText(file))
                {
                    var source  = reader.ReadToEnd();
                    var results = _provider.CompileAssemblyFromSource(_parameters, source);
                    var javascriptCompilerResult = new JavascriptCompilerResult();

                    foreach (var error in results.Errors.Cast <CompilerError>().Where(error => !_ignoredRules.Contains(error.ErrorNumber)))
                    {
                        javascriptCompilerResult.Errors.Add(error);
                    }

                    compilerResults.Add(file, javascriptCompilerResult);
                }
            }

            return(compilerResults);
        }
        /// <summary>
        /// Compiles the specified Javascript files.
        /// </summary>
        /// <param name="files">The absolute file paths to .js files.</param>
        public IDictionary<string, JavascriptCompilerResult> Compile(params string[] files)
        {
            var compilerResults = new Dictionary<string, JavascriptCompilerResult>();

            foreach (var file in files)
            {
                using (var reader = File.OpenText(file))
                {
                    var source = reader.ReadToEnd();
                    var results = _provider.CompileAssemblyFromSource(_parameters, source);
                    var javascriptCompilerResult = new JavascriptCompilerResult();

                    foreach (var error in results.Errors.Cast<CompilerError>().Where(error => !_ignoredRules.Contains(error.ErrorNumber)))
                    {
                        javascriptCompilerResult.Errors.Add(error);
                    }

                    compilerResults.Add(file, javascriptCompilerResult);
                }
            }

            return compilerResults;
        }
        public JavascriptCompilerResult Compile(string source)
        {
            var results = _provider.CompileAssemblyFromSource(_parameters, source);
            var javascriptCompilerResult = new JavascriptCompilerResult();

            foreach (var error in results.Errors.Cast<CompilerError>().Where(error => !_ignoredRules.Contains(error.ErrorNumber)))
            {
                javascriptCompilerResult.Errors.Add(error);
            }

            return javascriptCompilerResult;
        }