• Resolved j4yn3

    (@j4yn3)


    Good morning,
    After several tries all my css files don’t go through FVM and are not ignored either. It is not part of the treaty.
    I use WPBakery plugin and the Spalab 4.5 theme which has a “title.css” file (and others) contained in the “shortcodes” folder. However some files in this folder are processed by FVM and some are not.
    How do you explain this phenomenon?

    I tried several configurations by putting it in the “ignore list” but it only works for all the files in a folder and not for a particular file (title.css here).

    PS: I have already read the FAQ without success

    • This topic was modified 4 years, 7 months ago by j4yn3.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Raul P.

    (@alignak)

    It’s explained in the faqs and description,
    https://www.ads-software.com/plugins/fast-velocity-minify/faq/

    FVM can only detect files that have been enqueued properly, through the wordpress hooks and filters official method.
    https://developer.www.ads-software.com/themes/basics/including-css-javascript/

    Either those few files are not “enqueued” or they need to add some other logic, which removes them from the queue.

    The ignore list, is only for things you want FVM to ignore, not the way around.
    If you put those files there, they will not be processed.

    I am not familiar with Spalab 4.5 but maybe ask the author, if they can ensure all scripts and styles are enqueued, using the official wordpress method.

    Also check, if you don’t have some other plugin messing up the order of scripts, trying to load async, doing minification, or whatever. Your theme may also have options to merge or separate those files.

    Thread Starter j4yn3

    (@j4yn3)

    Thank you for your prompt response. I’ll take a closer look, but I thought it was weird for files in the same folder that it wasn’t “enqueued”

    Plugin Author Raul P.

    (@alignak)

    Yes I agree, but being in the same folder doesn’t matter. Each file still needs to be enqueued.

    Some developers add the files directly to the header, or use other filters and hooks, which are not recommended according to official documentation.

    It may not be necessary to use the official docs 100% the cases, depending on the intended usage by the theme developer… but then, if they don’t use the official methods, FVM won’t be able to pick it up.

    I’ve been working on some methods to bypass that restriction, but it’s not yet ready for production.

    Thread Starter j4yn3

    (@j4yn3)

    Hello Raul,

    Here is the response from the theme developers:

    “Yes, We included ‘wp_enqueue_style’ and ‘wp_enqueue_script’.
    Please use third party plugins to minify CSS and JS.

    EX: https://code.tutsplus.com/articles/configuring-w3-total-cache-advanced-minification-settings–wp-31043
    Regards., DesignThemes Support”

    Source: https://themeforest.net/item/spa-lab-beauty-spa-beauty-salon-wordpress-theme/8795615/comments?utf8=%E2%9C%93&term=Minify&from_buyers_and_authors_only=0

    Thread Starter j4yn3

    (@j4yn3)

    And another theme developers answer today:

    “Yes the scripts are included properly in our theme.”

    So can we try to figure out why I’m having problems with FVM?

    Plugin Author Raul P.

    (@alignak)

    Properly, is debatable. I’ve seen a lot of developers doing stuff with an attitude “as long as it works” so I am not sure about that.

    Can you zip the theme, put it on google drive, dropbox or whatever, add share it via my contact form on fastvelocity.com ?
    I’ll take a look and see what is going on when I have some time.

    Plugin Author Raul P.

    (@alignak)

    I installed the theme without any other plugins, using only FVM and all css and js files are being merged properly, meaning, they are also enqueued properly.

    There are some conflicts when merging CSS due to the lack of specificity in some files https://www.smashingmagazine.com/2007/07/css-specificity-things-you-should-know/

    In my case, I had to exclude /wp-content/themes/spalab/css/custom.css via the ignore list, or alternatively, choose to inline all css without ignoring the file.

    This works, because merging they are executed as one css file, while with inlining, they are still considered separate style rules, and so the last one wins.

    Basically, the code on custom.css is causing the header background to disappear on my demo, when merged together with the others, due to the lack of specificity on other css files that come before it.

    But other than that, all files found were merged.

    There is no shortcodes directory on your theme, and neither there is any title.css file on it, so the issue is nothing to do with the theme, but rather one of your other plugins adding that css file.

    I then proceeded to install and activate all recommended, bundled plugins.

    This time there are 3 css files.
    First one is merged by FVM.
    Second one is https://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css
    Third one is merged by FVM.

    Because you have an external file, that file splits the merging.
    If you add it under the External URLs to Merge on the Pro tab, it get’s merged together and you are now left with only 1 FVM generated file.

    View post on imgur.com

    This is the correct behaviour and for some reason, the specificity issue I explained earlier no longer applies, because now the other plugins installed have either corrected it, changed it’s order or added new code to overwrite it (so no need to exclude).

    This is the list of merged css files I get:
    https://pastebin.com/GeJm5Tdh

    I can assume, that the title.css file you are talking about, is generated by one of the plugins, only when you add something on certain page via the editor, likely wpbakery.

    You can see the full url on that file, and it will tell you exactly the path to the plugin which is not enqueuing the file properly. It should not be the theme… unless you are using a child theme that has been customized by another developer that didn’t follow the official documentation method of enqueuing the files.

    Note however, it could be a limitation of their plugin.
    If they are including the file with javascript conditionaly, or if they need to load extra style if something is present or not, that could explain it.

    Either way, nothing I can do on my end regarding that situation.
    As explained, the plugin only capture files enqueued with the official wordpress method, and so far, all files I saw on that theme and recommended plugins have been captured.

    It’s something specific to some module, slider, or whatever is on that page, that it’s adding the css file directly to the page, without enqueuing.

    In the future, FVM will be able to capture all CSS regardless of being enqueued or not, but for now that’s how it works for compatibility reasons.

    • This reply was modified 4 years, 7 months ago by Raul P..
    • This reply was modified 4 years, 7 months ago by Raul P..
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Minify CSS’ is closed to new replies.