| 1 | /* jshint node:true */ |
| 2 | module.exports = function(grunt) { |
| 3 | var path = require('path'); |
| 4 | |
| 5 | // Load tasks. |
| 6 | require('matchdep').filterDev(['grunt-*']).forEach( grunt.loadNpmTasks ); |
| 7 | |
| 8 | // Project configuration. |
| 9 | grunt.initConfig({ |
| 10 | rtlcss: { |
| 11 | options: { |
| 12 | // rtlcss options |
| 13 | config: { |
| 14 | swapLeftRightInUrl: false, |
| 15 | swapLtrRtlInUrl: false, |
| 16 | autoRename: false, |
| 17 | preserveDirectives: false, |
| 18 | stringMap: [ |
| 19 | { |
| 20 | name: 'import-rtl-stylesheet', |
| 21 | search: [ '.css' ], |
| 22 | replace: [ '-rtl.css' ], |
| 23 | options: { |
| 24 | scope: 'url', |
| 25 | ignoreCase: false |
| 26 | } |
| 27 | } |
| 28 | ] |
| 29 | }, |
| 30 | properties : [ |
| 31 | { |
| 32 | name: 'swap-dashicons-left-right-arrows', |
| 33 | expr: /content/im, |
| 34 | action: function( prop, value ) { |
| 35 | if ( value === '"\\f141"' ) { // dashicons-arrow-left |
| 36 | value = '"\\f139"'; |
| 37 | } else if ( value === '"\\f340"' ) { // dashicons-arrow-left-alt |
| 38 | value = '"\\f344"'; |
| 39 | } else if ( value === '"\\f341"' ) { // dashicons-arrow-left-alt2 |
| 40 | value = '"\\f345"'; |
| 41 | } else if ( value === '"\\f139"' ) { // dashicons-arrow-right |
| 42 | value = '"\\f141"'; |
| 43 | } else if ( value === '"\\f344"' ) { // dashicons-arrow-right-alt |
| 44 | value = '"\\f340"'; |
| 45 | } else if ( value === '"\\f345"' ) { // dashicons-arrow-right-alt2 |
| 46 | value = '"\\f341"'; |
| 47 | } else if ( value === '"\\2192"' ) { // Unicode rightwards arrow |
| 48 | value = '"\\2190"'; |
| 49 | } else if ( value === '"\\2190"' ) { // Unicode leftwards arrow |
| 50 | value = '"\\2192"'; |
| 51 | } |
| 52 | return { prop: prop, value: value }; |
| 53 | } |
| 54 | } |
| 55 | ], |
| 56 | saveUnmodified: false |
| 57 | }, |
| 58 | styles: { |
| 59 | expand: true, |
| 60 | ext: '-rtl.css', |
| 61 | src: [ |
| 62 | 'forum-wp4.css', |
| 63 | 'wp4.css', |
| 64 | ] |
| 65 | }, |
| 66 | } |
| 67 | }); |
| 68 | |
| 69 | // Register tasks. |
| 70 | |
| 71 | grunt.registerTask( 'build', [ |
| 72 | 'rtlcss' |
| 73 | ] ); |
| 74 | |
| 75 | // Default task. |
| 76 | grunt.registerTask('default', ['build']); |
| 77 | |
| 78 | }; |
| 79 | |