Skip to:
Content

bbPress.org

Changeset 5285


Ignore:
Timestamp:
02/11/2014 04:29:19 PM (9 years ago)
Author:
johnjamesjacoby
Message:

More Grunt improvements:

  • Fixes CSS & JS admin folder path for BBP_RTL_CSS, BBP_LTR_CSS & BBP_JS in Gruntfile.js
  • Removes Mint & Evergreen CSS (including RTL) to use Mint & Evergreen SCSS
  • Adds _admin.scss, _mixins.scss, _variables.scss via (/trunk/src/wp-admin/css/colors) to build our Mint & Evergreen admin themes
  • Adds /includes/admin/styles/evergreen/colors.scss & /includes/admin/styles/mint/colors.scss via 2288dcd5b5 MP6 GitHub Repo Changset
  • Adds support in Gruntfile.js to build minified and RTL Mint & Evergreen CSS
  • Adds grunt-sass ~0.10.0 to package.json to build Mint & Evergreen CSS from SCSS source
  • Reinstates minified and SCRIPT_DEBUG support for minified Mint & Evergreen CSS
  • Adds minified and SCRIPT_DEBUG support for admin javascript & frontend javascript

Props netweb. See #2542.

Location:
trunk
Files:
7 added
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r5271 r5285  
    66
    77    BBP_RTL_CSS = [
    8         'admin/css/*-rtl.css',
     8        'includes/admin/css/*-rtl.css',
     9        'includes/admin/styles/*-rtl.css',
    910        'templates/default/css/*-rtl.css'
    1011    ],
    1112
    1213    BBP_LTR_CSS = [
    13         'admin/css/*.css',
     14        'includes/admin/css/*.css',
     15        'includes/admin/styles/*.css',
    1416        'templates/default/css/*.css'
    1517    ],
    1618
    1719    BBP_JS = [
    18         'admin/js/*.js',
     20        'includes/admin/js/*.js',
    1921        'templates/default/js/*.js'
    2022    ],
     
    8385            }
    8486        },
     87        sass: {
     88            colors: {
     89                expand: true,
     90                cwd: SOURCE_DIR,
     91                dest: BUILD_DIR,
     92                ext: '.css',
     93                src: ['includes/admin/styles/*/colors.scss'],
     94                options: {
     95                    outputStyle: 'expanded'
     96                }
     97            }
     98        },
    8599        cssmin: {
    86100            ltr: {
     
    99113                src: BBP_RTL_CSS,
    100114                options: { banner: '/*! https://wordpress.org/plugins/bbpress/ */' }
     115            },
     116            colors: {
     117                cwd: BUILD_DIR,
     118                dest: BUILD_DIR,
     119                expand: true,
     120                ext: '.min.css',
     121                src: [
     122                    'includes/admin/styles/*/*.css'
     123                ]
    101124            }
    102125        },
     
    109132                src: BBP_LTR_CSS,
    110133                options: { generateExactDuplicates: true }
     134            },
     135            colors: {
     136                options: {
     137                    processContent: function( src ) {
     138                        return src.replace( /([^/]+)\.css/gi, '$1-rtl.css' );
     139                    }
     140                },
     141                expand: true,
     142                cwd: BUILD_DIR,
     143                dest: BUILD_DIR,
     144                ext: '-rtl.css',
     145                src: [
     146                    'includes/admin/styles/*/colors.css'
     147                ]
    111148            },
    112149            dynamic: {
     
    203240                }
    204241            },
     242            colors: {
     243                files: [SOURCE_DIR + 'includes/admin/styles/**'],
     244                tasks: ['sass:colors']
     245            },
    205246            rtl: {
    206247                files: BBP_LTR_CSS.map( function( path ) {
     
    216257    });
    217258
     259    // Register tasks.
     260
     261    // Color schemes task.
     262    grunt.registerTask('colors', ['sass:colors']);
    218263
    219264    // Build tasks.
    220     grunt.registerTask( 'build',         [ 'clean:all', 'copy:files', 'cssjanus:core', 'cssmin:ltr', 'cssmin:rtl', 'uglify:core', 'jsvalidate:build' ] );
    221     grunt.registerTask( 'build-release', [ 'clean:all', 'copy:files', 'cssjanus:core', 'cssmin:ltr', 'cssmin:rtl', 'uglify:core', 'jsvalidate:build', 'phpunit:all' ] );
     265    grunt.registerTask( 'build',         [ 'clean:all', 'copy:files', 'cssjanus:core', 'cssmin:ltr', 'cssmin:rtl', 'colors', 'cssjanus:colors', 'cssmin:colors','uglify:core', 'jsvalidate:build' ] );
     266    grunt.registerTask( 'build-release', [ 'clean:all', 'copy:files', 'cssjanus:core', 'cssmin:ltr', 'cssmin:rtl', 'colors', 'cssjanus:colors', 'cssmin:colors','uglify:core', 'jsvalidate:build', 'phpunit:all' ] );
    222267
    223268    // Testing tasks.
     
    235280    grunt.registerTask( 'default', [ 'build' ] );
    236281
    237 
    238282    // Add a listener to the watch task.
    239283    //
  • trunk/package.json

    r5271 r5285  
    1414    "grunt-contrib-jshint": "~0.8.0",
    1515    "grunt-cssjanus": "~0.2.2",
     16    "grunt-sass": "~0.10.0",
    1617    "grunt-phpunit": "~0.3.2",
    1718    "grunt-jsvalidate": "~0.2.2",
  • trunk/src/includes/admin/admin.php

    r5268 r5285  
    547547     */
    548548    public function enqueue_scripts() {
     549
     550        // Enqueue suggest for forum/topic/reply autocmopletes
    549551        wp_enqueue_script( 'suggest' );
    550        
     552
     553        // Minified
     554        $suffix  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     555
    551556        // Get the version to use for JS
    552557        $version = bbp_get_version();
     
    559564
    560565                    // Enqueue the common JS
    561                     wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'common.js', array( 'jquery' ), $version );
     566                    wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'common' . $suffix . '.js', array( 'jquery' ), $version );
    562567
    563568                    // Topics admin
    564569                    if ( bbp_get_topic_post_type() === get_current_screen()->post_type ) {
    565                         wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'topics.js', array( 'jquery' ), $version );
     570                        wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'topics' . $suffix . '.js', array( 'jquery' ), $version );
    566571
    567572                    // Replies admin
    568573                    } elseif ( bbp_get_reply_post_type() === get_current_screen()->post_type ) {
    569                         wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'replies.js', array( 'jquery' ), $version );
     574                        wp_enqueue_script( 'bbp-admin-common-js', $this->js_url . 'replies' . $suffix . '.js', array( 'jquery' ), $version );
    570575                    }
    571576
     
    614619
    615620        // RTL and/or minified
    616         $suffix = is_rtl() ? '-rtl' : '';
    617         //$suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     621        $suffix  = is_rtl() ? '-rtl' : '';
     622        $suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    618623
    619624        // Mint
    620625        wp_admin_css_color(
    621626            'bbp-mint',
    622             esc_html_x( 'Mint',      'admin color scheme', 'bbpress' ),
    623             $this->styles_url . 'mint' . $suffix . '.css',
     627            esc_html_x( 'Mint', 'admin color scheme', 'bbpress' ),
     628            $this->styles_url . 'mint/colors' . $suffix . '.css',
    624629            array( '#4f6d59', '#33834e', '#5FB37C', '#81c498' ),
    625630            array( 'base' => '#f1f3f2', 'focus' => '#fff', 'current' => '#fff' )
     
    630635            'bbp-evergreen',
    631636            esc_html_x( 'Evergreen', 'admin color scheme', 'bbpress' ),
    632             $this->styles_url . 'evergreen' . $suffix . '.css',
     637            $this->styles_url . 'evergreen/colors' . $suffix . '.css',
    633638            array( '#324d3a', '#446950', '#56b274', '#324d3a' ),
    634639            array( 'base' => '#f1f3f2', 'focus' => '#fff', 'current' => '#fff' )
  • trunk/src/templates/default/bbpress-functions.php

    r5183 r5285  
    169169        $scripts = array();
    170170
     171        // Minified
     172        $suffix  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     173
    171174        // Always pull in jQuery for TinyMCE shortcode usage
    172175        if ( bbp_use_wp_editor() ) {
    173176            $scripts['bbpress-editor'] = array(
    174                 'file'         => 'js/editor.js',
     177                'file'         => 'js/editor' . $suffix . '.js',
    175178                'dependencies' => array( 'jquery' )
    176179            );
     
    180183        if ( bbp_is_single_forum() ) {
    181184            $scripts['bbpress-forum'] = array(
    182                 'file'         => 'js/forum.js',
     185                'file'         => 'js/forum' . $suffix . '.js',
    183186                'dependencies' => array( 'jquery' )
    184187            );
     
    190193            // Topic favorite/unsubscribe
    191194            $scripts['bbpress-topic'] = array(
    192                 'file'         => 'js/topic.js',
     195                'file'         => 'js/topic' . $suffix . '.js',
    193196                'dependencies' => array( 'jquery' )
    194197            );
     
    197200            if ( bbp_thread_replies() ) {
    198201                $scripts['bbpress-reply'] = array(
    199                     'file'         => 'js/reply.js',
     202                    'file'         => 'js/reply' . $suffix . '.js',
    200203                    'dependencies' => array( 'jquery' )
    201204                );
     
    206209        if ( bbp_is_single_user_edit() ) {
    207210            $scripts['bbpress-user'] = array(
    208                 'file'         => 'js/user.js',
     211                'file'         => 'js/user' . $suffix . '.js',
    209212                'dependencies' => array( 'user-query' )
    210213            );
Note: See TracChangeset for help on using the changeset viewer.