c# - How to detect if a JS is packed already -


hey guys.. writing windows application in c# minifies css files , packs js files batch job. 1 hurdle application is, if user selects javascript file has been packed? end increasing file size, defeating purpose entirely!

is opening file , looking string eval(function(p,a,c,k,e,d) enough? guess no, there other js packing methods out there. me out!

one might suggest compare size of pre , post packed js , return/use smaller of two.

update based on question in comment gpx on sep 30 @ 1:02

the following simple way tell. there may different, or more accurate, ways of determining this, should going in right direction:

var unpackedjs = file.readalltext(...) var unpackedsize = jscontent.length; var packedjs = ... // packaging routine file.writealltext(pathtofile, unpackedsize < packedjs.length ? unpackedjs : packedjs) 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -