Making WordPress.org

Changeset 3359


Ignore:
Timestamp:
06/14/2016 12:14:42 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: First pass at RTL styles.

See #1719.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/Gruntfile.js

    r3193 r3359  
    2020            }
    2121        },
     22        rtlcss: {
     23            options: {
     24                // rtlcss options
     25                opts: {
     26                    clean: false,
     27                    processUrls: { atrule: true, decl: false },
     28                    stringMap: [
     29                        {
     30                            name: 'import-rtl-stylesheet',
     31                            priority: 10,
     32                            exclusive: true,
     33                            search: [ '.css' ],
     34                            replace: [ '-rtl.css' ],
     35                            options: {
     36                                scope: 'url',
     37                                ignoreCase: false
     38                            }
     39                        }
     40                    ]
     41                },
     42                saveUnmodified: false,
     43                plugins: [
     44                    {
     45                        name: 'swap-dashicons-left-right-arrows',
     46                        priority: 10,
     47                        directives: {
     48                            control: {},
     49                            value: []
     50                        },
     51                        processors: [
     52                            {
     53                                expr: /content/im,
     54                                action: function( prop, value ) {
     55                                    if ( value === '"\\f141"' ) { // dashicons-arrow-left
     56                                        value = '"\\f139"';
     57                                    } else if ( value === '"\\f340"' ) { // dashicons-arrow-left-alt
     58                                        value = '"\\f344"';
     59                                    } else if ( value === '"\\f341"' ) { // dashicons-arrow-left-alt2
     60                                        value = '"\\f345"';
     61                                    } else if ( value === '"\\f139"' ) { // dashicons-arrow-right
     62                                        value = '"\\f141"';
     63                                    } else if ( value === '"\\f344"' ) { // dashicons-arrow-right-alt
     64                                        value = '"\\f340"';
     65                                    } else if ( value === '"\\f345"' ) { // dashicons-arrow-right-alt2
     66                                        value = '"\\f341"';
     67                                    }
     68                                    return { prop: prop, value: value };
     69                                }
     70                            }
     71                        ]
     72                    }
     73                ]
     74            },
     75            dynamic: {
     76                expand: true,
     77                cwd: 'css/',
     78                dest: 'css/',
     79                ext: '-rtl.css',
     80                src: ['**/style.css']
     81            }
     82        },
    2283        watch: {
    2384            js: {
     
    2889                files: ['**/*.scss'],
    2990                tasks: ['sass']
     91            },
     92            rtl: {
     93                files: ['**/style.css'],
     94                tasks: ['rtlcss:dynamic']
    3095            }
    3196        }
     
    3398
    3499    grunt.loadNpmTasks('grunt-sass');
     100    grunt.loadNpmTasks('grunt-rtlcss');
    35101    grunt.loadNpmTasks('grunt-contrib-jshint');
    36102    grunt.loadNpmTasks('grunt-contrib-watch');
    37103
    38     grunt.registerTask('default', ['jshint', 'sass']);
     104    grunt.registerTask('default', ['jshint', 'sass', 'rtlcss:dynamic']);
    39105};
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r3355 r3359  
    6767 */
    6868function scripts() {
    69     wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . '/css/style.css', array(), time() );
     69    $suffix = is_rtl() ? '-rtl' : '';
     70    wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . "/css/style{$suffix}.css", array(), time() );
    7071
    7172    wp_enqueue_script( 'wporg-plugins-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
Note: See TracChangeset for help on using the changeset viewer.