Code Monkey home page Code Monkey logo

Comments (5)

futtta avatar futtta commented on May 25, 2024 1

closing, lack of interest, lack of resources & lack of PR's for this B-)

from autoptimize.

futtta avatar futtta commented on May 25, 2024

well, can you first describe how a TOC would look like? simply a list of the filenames of aggregated CSS-files?

from autoptimize.

szepeviktor avatar szepeviktor commented on May 25, 2024

Yes, the idea is from https://github.com/kasparsd/minit

/* TOC
http://site.net/small.css
http://site.net/large.css
*/

from autoptimize.

futtta avatar futtta commented on May 25, 2024

in that case;

  1. create a boolean $includetoc which gets its value from apply filter "autoptimize_fitler_jscss_toc" which defaults to false
  2. in the minify function at the start you'll see code that goes through the media-types and for each mediatype gets all CSS (inline or file_get_contents-wise). if $includetoc returns true, you can create an array $toc[] to store the filenames (from var $cssPath) or "#inline" if from inline code
  3. in the "manage the @imports"-section you'll have to again add filenames to that array for every imported stylesheet
  4. you might want to also add base64'ed inlined background-images in there as well, if you want to be thorough ("// Do the imaging!")
  5. after the aggregated CSS-code has been minified, around the time the "autoptimize_css_after_minify" filter is applied, if $includetoc is true and if there is data in the $toc-array, you would insert the data from the TOC into the CSS.

and once that is done, you could create something similar for JS :-)

the rest is ... trial and error!

have fun!
frank

from autoptimize.

futtta avatar futtta commented on May 25, 2024

Someone asked me about this in a mail as well. I'm still not convinced this should be in AO proper, but as I wrote to that user this can easily be done using the API;

You could hook into the AO API to create a TOC if you're into that kind of things ;-)

  1. create a function to hook into autoptimize_js_individual_style
  2. in that function grab the 2nd incoming parameter and add that to a tmp string (which would be added to for each file) and return false
  3. create a 2nd function to hook into autoptimize_js_after_minify
  4. in that function add the tmp string (in between JS comment tags) to the incoming optimized JS and returning the optimized JS which now has your TOC

frank

from autoptimize.

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.