Open Pypeline opened 10 years ago
I guess I didn't consider instances where there's more than 1 minified and combined JS file, because this way would result in the extra scripts being added to each file put together by the plugin. I was focused on my use case of a single js file produced.
Still, might be something that can be done about that without much trouble.
I'm not sure if this would be a generically needed feature, since it'd invalidate the whole cached file if any inline script/css changes slightly. And I'm seeing little benefit of doing so, since for caching, this should be taken care of by page cache if activated, and for minification, there would be much less benefit since normally inline styles/scripts shouldn't be that big, also it'd be taken care of by HTML minifying/caching plugins.
Good point, thanks for the feedback.
I've been playing around with the plugin and needed a way to get some scripts that were inline (needing to use variables from php) into the concatenated/minified js file. Working on trying to get down to 1 js and 1css file. Anyway, I added a filter in the minify function just before stuff starts getting passed to the minify libraries.
looks like this:
You'd want to check for $type depending on wether you're adding scripts or styles, and then you need to add a source name (URL seems irrelevant) and the js/css to the array of sources. This "inline" stuff wouldn't show up in the list of included dependency bundles but didn't seem like a big deal.
Just wondering if this is a feature that would be wanted in the plugin. Or if I missed something and there's already a better way to do this included! I can do a pull request if you're interested.