Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Khang Minh

    (@oddoneout)

    I don’t think the Minify library itself supports that. However, you can enqueue twentytwelve’s style.css in your child theme’s functions.php instead of importing it inside your child theme’s style.css; that way BWP Minify will happily minify twentytwelve’s style.css.

    Thread Starter meeble

    (@meeble)

    Hi,

    Thanks for the response. I think I finally got it working. I do have one question though…

    Here’s my site: http://laserlightshows.us

    When looking at my page source, I see two css files:

    <link rel='stylesheet' id='twentytwelve-style-css'  href='http://cf.laserlightshows.us/wp-content/min/?f=wp-content%2Fthemes%2F2012%2Fstyle.css&ver=3.5-RC3' type='text/css' media='all' />
    
    and 
    
    <link rel='stylesheet' type='text/css' media='all' href='http://cf.laserlightshows.us/wp-content/min/?f=wp-content/plugins/contact-form-7/includes/css/styles.css,wp-content/themes/twentytwelve/style.css' />

    why aren’t these combined into one file?

    I was also wondering why the slashes in the first URL were being html entity encoded?

    Thanks,
    Devin

    Thread Starter meeble

    (@meeble)

    actually, now it seems that my child theme’s style.css isn’t quite working right. It IS loading, but some of my style declarations don’t seem to be working now that I’ve changed the way I’m importing in the parent theme’s css. how strange. Could it be that the parent theme css is now being called after the chils theme css, hence overriding it? It is being loaded further down the page, it seems…

    Thread Starter meeble

    (@meeble)

    ugh, this is so frustrating. Ok, so I took out the @import line from my child style.css file. Then I added this to my functions.php file:

    function theme_styles()
    {
      wp_enqueue_style( 'twentytwelve' );
    }
    add_action('wp_enqueue_scripts', 'theme_styles');

    But all this does is dynamically insert the @import line back into my child style.css which means BWPM isn’t minifying it.

    Thread Starter meeble

    (@meeble)

    Ok, got it working. I ended up putting this in my functions.php file:

    function parent_styles()
    {
        wp_register_style( 'twentytwelve',
        get_template_directory_uri() . '/style.css',
        array(),
        '20121205',
        'all' );
    
      wp_enqueue_style( 'twentytwelve' );
    
    }
    add_action('wp_enqueue_scripts', 'parent_styles',11);
    
    function child_styles()
    {
        wp_register_style( '2012',
        get_stylesheet_directory_uri() . '/style.css',
        array(),
        '20121205',
        'all' );
    
      wp_enqueue_style( '2012' );
    
    remove_action('wp_head', 'wlwmanifest_link');
    remove_action('wp_head', 'wp_generator');
    }
    add_action('wp_enqueue_scripts', 'child_styles',12);

    and I commented this line out of my parent’s (twentytwelve) functions.php file:

    wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );

    I hate having to mess around with my parent theme’s files, but it works now.

    Thread Starter meeble

    (@meeble)

    well, after upgrading WP, the functions.php got replaced, which made me realize that this isn’t a good solution. I’ve spent several hours trying to minify the parent twentytwelve css file, but I just can’t seem to make it work. Currently, I can get the parent style.css to load in above the child style.css in the html, but as soon as I enable BWPM, it moves the parent style.css further down, which breaks my child css. This really shouldn’t be so complicated…

    Thread Starter meeble

    (@meeble)

    FINALLY!

    this actually works.

    function dequeue_styles() {
        wp_deregister_style( 'twentytwelve-style' );
        wp_dequeue_style( 'twentytwelve-style' );
    }
    add_action( 'wp_print_styles', 'dequeue_styles' );
    
    // enqueue parent stylesheet before child css and minify
    function parent_styles()
    {
    wp_register_style( 'twentytwelve',
    get_template_directory_uri() . '/style.css'
    );
    wp_enqueue_style( 'twentytwelve' );
    }
    add_action('wp_enqueue_scripts', 'parent_styles');
    
    function child_styles()
    {
    wp_register_style( '2012',
    get_stylesheet_directory_uri() . '/style.css'
    );
    wp_enqueue_style( '2012' );
    }
    add_action('wp_enqueue_scripts', 'child_styles');
    justinparks

    (@justinparks)

    I dropped that into the childtheme folder functions.php – works perfectly! Nice work meeble!

    Very interesting. What is the “2012” for ?

    I got it! It’s the child theme name 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘BWPM is minifying child style.css, but not parent?’ is closed to new replies.