yuicompressor-net / yuicompressor.net Goto Github PK
View Code? Open in Web Editor NEWPort of Yahoo!'s Java YUICompressor to .NET
License: BSD 3-Clause "New" or "Revised" License
Port of Yahoo!'s Java YUICompressor to .NET
License: BSD 3-Clause "New" or "Revised" License
Hi.
Can you please sign this nice library it's important for me because I'm going to use this library with another signed with key library which have reference to YUICompressor.NET.
Will there be a release version compatible with .Net Core?
We use YUICompressor.NET in our build chain, and we like the "compile"-time checks that are performed to tell us about potential issues in our javascript codebase. We found an issue with IE7 clients around an edge-case in Javascript syntax. If there were any array or object declarations with a comma and no other token between the closing brace or bracket, an exception would be thrown. See below example. This seems to be acceptable in other browsers.
var anObject = {a:1, b:'2',}; // the last comma causes an exception in IE7 and earlier
var anArray = [1,2,3,]; // the last comma causes an exception in IE7 and earlier
We decided to disallow this in our codebase to be safe, and added a check to YUICompressor.NET to find and warn on these situations.
I have added a new option DisallowNakedComma to warn on the above situation, which is defaulted to NOT warn for backwards compatibility.
Is it posible to add a progressEvent who return the current state of the compress?
that something like that is possible:
var jsc = new JavaScriptCompressor();
jsc.CompressProgressChanged += new OnCompressProgressChanged((CompressProgressChangedEventArgs arg) =>
{
Console.WriteLine(arg.FilesList.Count + " files will be compressed." + arg.Progress + " % are done. (Speed:" + arg.Speed + ")");
});
jsc.CompressCompleted += new OnCompressCompleted((CompressCompletedEventArgs arg) =>
{
Console.WriteLine(arg.FilesList.Count + " files are compressed in "+ arg.ProgressTime + ". (MaxSpeed:" + arg.MaxSpeed + " | MinSpeed:" + arg.MinSpeed + ")");
});
jsc.Compress("");
I guess YUI Compressor can show the error line and column. An online compressor was able to find the location of the error. However MSBuild task doesn't show any details.
Date check - (end of 2016).
sif NUnit.
en Yahoo.Yui.Compressor.CustomErrorReporter.Error(String message, String sourceName, Int32 line, String lineSource, Int32 lineOffset)
en EcmaScript.NET.Parser.AddError(String messageId)
en EcmaScript.NET.Parser.ReportError(String messageId)
en EcmaScript.NET.Parser.memberExprTail(Boolean allowCallSyntax, Node pn)
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.expr(Boolean inForInit)
en EcmaScript.NET.Parser.statementHelper(Node statementLabel)
en EcmaScript.NET.Parser.statement()
en EcmaScript.NET.Parser.parseFunctionBody()
en EcmaScript.NET.Parser.function(Int32 functionType)
en EcmaScript.NET.Parser.primaryExpr()
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.primaryExpr()
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.primaryExpr()
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.argumentList(Node listNode)
en EcmaScript.NET.Parser.memberExprTail(Boolean allowCallSyntax, Node pn)
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.expr(Boolean inForInit)
en EcmaScript.NET.Parser.statementHelper(Node statementLabel)
en EcmaScript.NET.Parser.statement()
en EcmaScript.NET.Parser.parseFunctionBody()
en EcmaScript.NET.Parser.function(Int32 functionType)
en EcmaScript.NET.Parser.primaryExpr()
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.argumentList(Node listNode)
en EcmaScript.NET.Parser.memberExprTail(Boolean allowCallSyntax, Node pn)
en EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax)
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.unaryExpr()
en EcmaScript.NET.Parser.mulExpr()
en EcmaScript.NET.Parser.addExpr()
en EcmaScript.NET.Parser.shiftExpr()
en EcmaScript.NET.Parser.relExpr(Boolean inForInit)
en EcmaScript.NET.Parser.eqExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit)
en EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit)
en EcmaScript.NET.Parser.andExpr(Boolean inForInit)
en EcmaScript.NET.Parser.orExpr(Boolean inForInit)
en EcmaScript.NET.Parser.condExpr(Boolean inForInit)
en EcmaScript.NET.Parser.assignExpr(Boolean inForInit)
en EcmaScript.NET.Parser.expr(Boolean inForInit)
en EcmaScript.NET.Parser.statementHelper(Node statementLabel)
en EcmaScript.NET.Parser.statement()
en EcmaScript.NET.Parser.Parse()
en Yahoo.Yui.Compressor.JavaScriptCompressor.Parse(StreamReader stream, ErrorReporter reporter)
en Yahoo.Yui.Compressor.JavaScriptCompressor.DoCompress(String source)
en Yahoo.Yui.Compressor.Compressor.Compress(String source)
en MaiSyncFiles.Min.Static.JsMin.ChangeStream(Stream stream) en E:\Fuentes\MaiSyncFiles\MaiSyncFiles.Min.Static\JsMin.cs:lΓnea 31
Trying optimize this js (i know, its optimized yet..)
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){var r=t("matches-selector");e.exports=function(t,e,n){for(var o=n?t:t.parentNode;o&&o!==document;){if(r(o,e))return o;o=o.parentNode}}},{"matches-selector":2}],2:[function(t,e,n){function r(t,e){if(i)return i.call(t,e);for(var n=t.parentNode.querySelectorAll(e),r=0;r<n.length;++r)if(n[r]==t)return!0;return!1}var o=Element.prototype,i=o.matchesSelector||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector;e.exports=r},{}],3:[function(t,e,n){function r(t,e,n,r){var i=o.apply(this,arguments);return t.addEventListener(n,i),{destroy:function(){t.removeEventListener(n,i)}}}function o(t,e,n,r){return function(n){n.delegateTarget=i(n.target,e,!0),n.delegateTarget&&r.call(t,n)}}var i=t("closest");e.exports=r},{closest:1}],4:[function(t,e,n){n.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},n.nodeList=function(t){var e=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===e||"[object HTMLCollection]"===e)&&"length"in t&&(0===t.length||n.node(t[0]))},n.string=function(t){return"string"==typeof t||t instanceof String},n.function=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},{}],5:[function(t,e,n){function r(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.function(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return o(t,e,n);if(c.nodeList(t))return i(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function i(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return s(document.body,t,e,n)}var c=t("./is"),s=t("delegate");e.exports=r},{"./is":4,delegate:3}],6:[function(t,e,n){function r(t){var e;if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName)t.focus(),t.setSelectionRange(0,t.value.length),e=t.value;else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),n.removeAllRanges(),n.addRange(r),e=n.toString()}return e}e.exports=r},{}],7:[function(t,e,n){function r(){}r.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function r(){o.off(t,r),e.apply(n,arguments)}var o=this;return r.=e,this.on(t,r,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,o=n.length;for(r;o>r;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn.!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t("select"),c=r(a),s=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},t.prototype.initSelection=function t(){if(this.text&&this.target)throw new Error('Multiple attributes declared, use either "target" or "text"');if(this.text)this.selectFake();else{if(!this.target)throw new Error('Missing required attributes, use either "target" or "text"');this.selectTarget()}},t.prototype.selectFake=function t(){var e=this;this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){return e.removeFake()}),this.fakeElem=document.createElement("textarea"),this.fakeElem.style.position="absolute",this.fakeElem.style.left="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=c.default(this.fakeElem),this.copyText()},t.prototype.removeFake=function t(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function t(){this.selectedText=c.default(this.target),this.copyText()},t.prototype.copyText=function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(n){e=!1}this.handleResult(e)},t.prototype.handleResult=function t(e){e?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function t(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function t(){this.removeFake()},i(t,[{key:"action",set:function t(){var e=arguments.length<=0||void 0===arguments[0]?"copy":arguments[0];if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e){if(!e||"object"!=typeof e||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');this._target=e}},get:function t(){return this._target}}]),t}();n.default=s,e.exports=n.default},{select:6}],9:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.proto=e)}function a(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}n.__esModule=!0;var c=t("./clipboard-action"),s=r(c),u=t("tiny-emitter"),l=r(u),f=t("good-listener"),d=r(f),h=function(t){function e(n,r){o(this,e),t.call(this),this.resolveOptions(r),this.listenClick(n)}return i(e,t),e.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action="function"==typeof e.action?e.action:this.defaultAction,this.target="function"==typeof e.target?e.target:this.defaultTarget,this.text="function"==typeof e.text?e.text:this.defaultText},e.prototype.listenClick=function t(e){var n=this;this.listener=d.default(e,"click",function(t){return n.onClick(t)})},e.prototype.onClick=function t(e){var n=e.delegateTarget||e.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new s.default({action:this.action(n),target:this.target(n),text:this.text(n),trigger:n,emitter:this})},e.prototype.defaultAction=function t(e){return a("action",e)},e.prototype.defaultTarget=function t(e){var n=a("target",e);return n?document.querySelector(n):void 0},e.prototype.defaultText=function t(e){return a("text",e)},e.prototype.destroy=function t(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)},e}(l.default);n.default=h,e.exports=n.default},{"./clipboard-action":8,"good-listener":5,"tiny-emitter":7}]},{},[9])(9)});
Hi -
We are having troubles compressing VueJS using this package, although it works just fine using the original java version. Error message:
Failed to read/parse data in file [\scripts\libraries\vue.js]
missing : after property id
Also, it would help if the error message included the line number in the JS file that is being compressed so that we can debug it more easily.
It's impossible to reference YUICompressor.NET deployed from NuGet package from our strongly signed assembly.
Error 37 Assembly generation failed -- Referenced assembly 'Yahoo.Yui.Compressor' does not have a strong name
Could you please sign the assembly and publish a new package version?
Hi @PureKrome,
I just gave this msbuild task a try and found it really convenient! I haven't evaluated the correctness of the compression yet as it was only a trial. But I noticed one feature which was desperately lacking was the ability for the compressor to create missing folders by default. Because of this I'm having to create the folders before hand. Since my Js files exist in nested folders I don't have a choice but to recursively copy the entire structure before I transform. Here is what I'm doing.
<Target Name="BuildJsAndCss" BeforeTargets="WebFileSystemPublish">
<MakeDir Directories="$(OutputPath)obj\Debug\Package\PackageTmp\js"></MakeDir>
<MakeDir Directories="$(OutputPath)obj\Debug\Package\PackageTmp\css"></MakeDir>
<Copy
SourceFiles="@(_JsItemsToCopy)"
DestinationFiles="@(_JsItemsToCopy->'$(OutputPath)obj\Debug\Package\PackageTmp\js\%(RecursiveDir)%(Filename)%(Extension)')"
/>
<Copy
SourceFiles="@(_CssItemsToCopy)"
DestinationFiles="@(_CssItemsToCopy->'$(OutputPath)obj\Debug\Package\PackageTmp\css\%(RecursiveDir)%(Filename)%(Extension)')"
/>
<JavascriptCompressorTask
SourceFiles="%(JavascriptFiles.Identity)"
OutputFile="$(OutputPath)obj\Debug\Package\PackageTmp\%(JavascriptFiles.Identity)"></JavascriptCompressorTask>
<CssCompressorTask
SourceFiles="%(CssFiles.Identity)"
OutputFile="$(OutputPath)obj\Debug\Package\PackageTmp\%(CssFiles.Identity)"></CssCompressorTask>
</Target>
This feels cumbersome and unnecessary if the compressor is able to create the folder structure for me. Let me know if you think likewise. I could even give you pull request if you think this makes sense.
Add an option for source map generation.
Iesi.Collections has a conflict with NHibernate which uses version 4.0 and this project uses 2.0.
Iesi.Collections should get updated asap! π
ES5 οΌ
JavaScriptCompressor compressor = new JavaScriptCompressor();
compressor.Encoding = Encoding.UTF8;
string jssource = FileObj.ReadFile(Server.MapPath("/content/js/le.all.js"));
jssource = compressor.Compress(jssource);//min.js
// writefile....
ES6:
How do I compress ES6 javascripts?
Thank you. I hope I can answer that.
Based on the CSS example in MsBuildSample.xml I expected this to overwrite each .js file with the minified version without changing the filename, but I get "error : Output file cannot be the same as source file(s)." All the examples I've found for v2.7.0 involve concatenating files, but I'm trying to update YUI compressor for an existing site that does not concatenate files.
<ItemGroup>
<JSFiles Include="$(PublishRoot)\assets\js\**\*.js" />
</ItemGroup>
<JavaScriptCompressorTask
SourceFiles="@(JSFiles)"
OutputFile="%(JSFiles.Identity)"
/>
<!-- Code I'm replacing, from v1.4.0
<CompressorTask
JavaScriptFiles="%(JSFiles.FullPath)"
JavaScriptOutputFile="%(JSFiles.FullPath)"
/>
-->
I will concatenate some files, but it's a large site with so many files (and so many pages pointing to those files), that the individually-minified files will need to remain on the servers for quite a while.
When attempting to compress:
var promise = new Promise(function (resolve, reject) {
reject(new Error('Test'));
} );
promise
.then(function(){console.log('success')})
.catch(function(e) {console.error(e)});
I get the error: Message "missing name after . operator"
Full stack trace:
at Yahoo.Yui.Compressor.CustomErrorReporter.Error(String message, String sourceName, Int32 line, String lineSource, Int32 lineOffset) in C:\projects\yuicompressor-net\Code\Yahoo.Yui.Compressor\CustomErrorReporter.cs:line 57
at EcmaScript.NET.Parser.AddError(String messageId) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 96
at EcmaScript.NET.Parser.ReportError(String messageId) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 103
at EcmaScript.NET.Parser.memberExprTail(Boolean allowCallSyntax, Node pn) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1963
at EcmaScript.NET.Parser.memberExpr(Boolean allowCallSyntax) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1898
at EcmaScript.NET.Parser.unaryExpr() in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1736
at EcmaScript.NET.Parser.mulExpr() in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1649
at EcmaScript.NET.Parser.addExpr() in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1629
at EcmaScript.NET.Parser.shiftExpr() in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1607
at EcmaScript.NET.Parser.relExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1577
at EcmaScript.NET.Parser.eqExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1525
at EcmaScript.NET.Parser.bitAndExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1514
at EcmaScript.NET.Parser.bitXorExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1503
at EcmaScript.NET.Parser.bitOrExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1492
at EcmaScript.NET.Parser.andExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1480
at EcmaScript.NET.Parser.orExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1468
at EcmaScript.NET.Parser.condExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1451
at EcmaScript.NET.Parser.assignExpr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1433
at EcmaScript.NET.Parser.expr(Boolean inForInit) in C:\projects\ecmascript-net\Code\EcmaScript.NET\Parser.cs:line 1422
Same issue as reported here: yui/yuicompressor#203
I will also forward this along to the EcmaScript.NET project (since that is where the source issue is coming from)
Hi,
Following up on #1 , I needed a signed package so I pushed one to nuget:
https://www.nuget.org/packages/YUICompressor.NET.Signed/
from this fork:
https://github.com/tomap/YUICompressor.NET
I also switched to .Net 4.5 :)
Regards,
Thomas
Couldn't find an email to send this too, so I posted it here.
I built a new bundling library for Nancyfx using YUICompressor.NET.
https://github.com/donnyv/Nancy.BundleIt
Hi
We have a issue when trying to run the compression with getters and setters
get isMobile() { //return true or false },
I see there's a fix for this problem in the yui compressor version 2.4.8
https://github.com/yui/yuicompressor/releases
Is there any plan to upgrade this?
These custom build tasks no longer seems to work as it's targeting 2.0 .net assemblies. After Windows Update ran on my build machine I get:
error MSB4062: The "CssCompressorTask" task could not be loaded from the assembly packages\YUICompressor.NET.MSBuild.2.7.0.0\lib\NET20\Yahoo.Yui.Compressor.Build.MsBuild.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask
This assembly is no longer in my GAC
If the RGB value (the first 6 bits of the value) are the same, the RGBA value (8-bit value) is compressed to 5 bits by the compressor. @PureKrome
class Program
{
static string CompressCSS()
{
var css = @"
a {
background: #F9BE4486;
color: #FFFFFF20;
}";
var compressor = new CssCompressor();
// The background value is correct.
// The expected result of color is #FFFFFF20, and the actual result is #FFF20.
var compressedCSS = compressor.Compress(css); // a{background:#F9BE4486;color:#FFF20}
return compressedCSS;
}
}
Some people don't have .NET 2.0 installed anymore.
Hi, I am trying to build/add a CSS snippet into the view - right in the local @Section {...<styles >}
using a simple
Action link, and help would be great... to create and return something like
ActionResult GetDynamicCss() {... .p { height: 210px } ..}
can you guide me is there a way to do this with this lib, or can we get a helper.
thanks
I have the error in this line of my code:
var url =
GetContactBy/${fieldName}/${fieldValue}/
;
this library does not support ECMA 16?
Do you any plans to support your library running on .NET Core in the near future?
When I commit a minified css file to Subversion is refuses to do it because of "Inconsistent EOL-Style". Is it something that could be solved?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.