Giter Site home page Giter Site logo

detect minified files about bot HOT 8 CLOSED

jsdelivr avatar jsdelivr commented on June 8, 2024
detect minified files

from bot.

Comments (8)

megawac avatar megawac commented on June 8, 2024

I think we can assume if sourceMappingURL\s*= is present in a comment in a file we can consider it minified. The only file I can think of off the top of my head that will break this assumption is bootstrap.css which has broken sourcemapping iirc

from bot.

tomByrer avatar tomByrer commented on June 8, 2024

sourceMappingURL\s*= is a great idea! What should happen if there is:
var sourceMappingURL = somefile.js? I'm thinking looking for a .map file is better.

Updated original post with test URL & Phase 2.

from bot.

megawac avatar megawac commented on June 8, 2024

thats why I said in a comment :)

from bot.

tomByrer avatar tomByrer commented on June 8, 2024

oops! Fixed top issue

from bot.

megawac avatar megawac commented on June 8, 2024

Lookin like a good start. @tomByrer I can give you pointers if you want to learn a bit of python and make a pr

from bot.

megawac avatar megawac commented on June 8, 2024

A branch of this issue is validating .map files: validate .map points to valid files; ensure x.map is referenced by some file; Ensure that file is minified... etc

from bot.

tomByrer avatar tomByrer commented on June 8, 2024

Yep, removing comments before checking if minified is helpful

from bot.

megawac avatar megawac commented on June 8, 2024

I think 547c10b is a reasonable fix based on average line lengths. Essentially I assume if a file has an average line width of 200 characters we classify the file as minified

from bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.