Comments (5)
closing, lack of interest, lack of resources & lack of PR's for this B-)
from autoptimize.
well, can you first describe how a TOC would look like? simply a list of the filenames of aggregated CSS-files?
from autoptimize.
Yes, the idea is from https://github.com/kasparsd/minit
/* TOC
http://site.net/small.css
http://site.net/large.css
*/
from autoptimize.
in that case;
- create a boolean $includetoc which gets its value from apply filter "autoptimize_fitler_jscss_toc" which defaults to false
- 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
- in the "manage the @imports"-section you'll have to again add filenames to that array for every imported stylesheet
- you might want to also add base64'ed inlined background-images in there as well, if you want to be thorough ("// Do the imaging!")
- 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.
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 ;-)
- create a function to hook into autoptimize_js_individual_style
- 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
- create a 2nd function to hook into autoptimize_js_after_minify
- 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)
- Make compatibility configurable HOT 8
- Compatible wih WP 6 and PHP 8.1 HOT 1
- Keep the code base clean HOT 3
- Undefined offset autoptimizeStyles.php HOT 3
- autoptimizecriticalcsscron PHP array key warnings HOT 5
- Avif support broken HOT 6
- Minified JS broken with private class identifiers HOT 4
- Disable emoji dns-prefetch in ClassicPress HOT 1
- PHP8 Warning HOT 1
- Optimized JS and inline script order HOT 3
- Problem with media="print" HOT 3
- Inline "background" not replaced with shortpixel HOT 5
- Security risk reported by Kaspersky HOT 6
- Proposal: stronger default settings HOT 9
- Optimised Google Fonts still blocking for 1.3s according to PageSpeed HOT 2
- Add: option to enable WebP as default output format HOT 1
- PHP Warning in cronjob: Trying to access array offset on value of type int in autoptimizeCacheChecker.php HOT 3
- Creation of dynamic property in autoptimizeProTab.php HOT 4
- Proposal: add Plugin Check workflow HOT 6
- Autoptimize deletes all subfolders in /cache/ HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autoptimize.