Skip to content

Commit

Permalink
fix: rtlcss loading for Header Grid and WooCommerce
Browse files Browse the repository at this point in the history
  • Loading branch information
abaicus committed Jun 19, 2019
1 parent 0a9a022 commit a0fc0e2
Show file tree
Hide file tree
Showing 8 changed files with 1,135 additions and 117 deletions.
8 changes: 5 additions & 3 deletions grunt/cssmin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ module.exports = {
},
customizerStyle: {
files: {
'assets/css/customizer-style.min.css': [ 'assets/css/customizer-style.css' ],
'assets/css/customizer-style-rtl.min.css': [ 'assets/css/customizer-style-rtl.css' ],
'style-rtl.min.css': [ 'style-rtl.css' ]
'assets/css/customizer-style.min.css': ['assets/css/customizer-style.css'],
'assets/css/customizer-style-rtl.min.css': ['assets/css/customizer-style-rtl.css'],
'style-rtl.min.css': ['style-rtl.css'],
'header-footer-grid/assets/css/style-rtl.min.css': ['header-footer-grid/assets/css/style-rtl.css'],
'header-footer-grid/assets/css/style.min.css': ['header-footer-grid/assets/css/style.css']
}
}
};
167 changes: 59 additions & 108 deletions grunt/rtlcss.js
Original file line number Diff line number Diff line change
@@ -1,118 +1,69 @@
/* jshint node:true */
// https://github.com/MohammadYounes/grunt-rtlcss
module.exports = {
style: {
// task options
options: {
'autoRename': false,
'autoRenameStrict': false,
'blacklist':{},
'clean': true,
'greedy': false,
'processUrls': false,
'stringMap': [
{
'name' : 'left-right',
'priority': 100,
'search' : ['left', 'Left', 'LEFT'],
'replace' : ['right', 'Right', 'RIGHT'],
'options' : {
'scope' : '*',
'ignoreCase' : false
}
},
{
'name' : 'ltr-rtl',
'priority': 100,
'search' : ['ltr', 'Ltr', 'LTR'],
'replace' : ['rtl', 'Rtl', 'RTL'],
'options' : {
'scope' : '*',
'ignoreCase' : false
}

const ext = '-rtl.css';
const options = {
'autoRename': false,
'autoRenameStrict': false,
'blacklist': {},
'clean': true,
'greedy': false,
'processUrls': false,
'stringMap': [
{
'name': 'left-right',
'priority': 100,
'search': ['left', 'Left', 'LEFT'],
'replace': ['right', 'Right', 'RIGHT'],
'options': {
'scope': '*',
'ignoreCase': false
}
]
},
expand : true,
cwd : './',
dest : './',
ext : '-rtl.css',
src : ['style.css']
{
'name': 'ltr-rtl',
'priority': 100,
'search': ['ltr', 'Ltr', 'LTR'],
'replace': ['rtl', 'Rtl', 'RTL'],
'options': {
'scope': '*',
'ignoreCase': false
}
}
]
};

module.exports = {
style: {
options,
expand: true,
cwd: './',
dest: './',
ext,
src: ['style.css']
},
woocommerce: {
// task options
options: {
'autoRename': false,
'autoRenameStrict': false,
'blacklist':{},
'clean': true,
'greedy': false,
'processUrls': false,
'stringMap': [
{
'name' : 'left-right',
'priority': 100,
'search' : ['left', 'Left', 'LEFT'],
'replace' : ['right', 'Right', 'RIGHT'],
'options' : {
'scope' : '*',
'ignoreCase' : false
}
},
{
'name' : 'ltr-rtl',
'priority': 100,
'search' : ['ltr', 'Ltr', 'LTR'],
'replace' : ['rtl', 'Rtl', 'RTL'],
'options' : {
'scope' : '*',
'ignoreCase' : false
}
}
]
},
expand : true,
cwd : './assets/css/',
dest : './assets/css/',
ext : '-rtl.css',
src : ['woocommerce.css']
options,
expand: true,
cwd: './assets/css/',
dest: './assets/css/',
ext,
src: ['woocommerce.css']
},
customizerStyle: {
// task options
options: {
'autoRename': false,
'autoRenameStrict': false,
'blacklist':{},
'clean': true,
'greedy': false,
'processUrls': false,
'stringMap': [
{
'name' : 'left-right',
'priority': 100,
'search' : ['left', 'Left', 'LEFT'],
'replace' : ['right', 'Right', 'RIGHT'],
'options' : {
'scope' : '*',
'ignoreCase' : false
}
},
{
'name' : 'ltr-rtl',
'priority': 100,
'search' : ['ltr', 'Ltr', 'LTR'],
'replace' : ['rtl', 'Rtl', 'RTL'],
'options' : {
'scope' : '*',
'ignoreCase' : false
}
}
]
},
expand : true,
cwd : './assets/css/',
dest : './assets/css/',
ext : '-rtl.css',
src : ['customizer-style.css']
options,
expand: true,
cwd: './assets/css/',
dest: './assets/css/',
ext,
src: ['customizer-style.css']
},
hfg: {
options,
expand: true,
cwd: './header-footer-grid/assets/css/',
dest: './header-footer-grid/assets/css/',
ext,
src: ['style.css']
},
};
5 changes: 4 additions & 1 deletion header-footer-grid/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ public function get_templates_location() {
*/
public function enqueue_scripts() {
$suffix = $this->get_assets_suffix();
wp_enqueue_style( 'hfg-style', esc_url( Config::get_url() ) . '/assets/css/style' . $suffix . '.css', array(), self::VERSION );
wp_register_style( 'hfg-style', esc_url( Config::get_url() ) . '/assets/css/style.min.css', array(), self::VERSION );
wp_style_add_data( 'hfg-style', 'rtl', 'replace' );
wp_style_add_data( 'hfg-style', 'suffix', '.min' );
wp_enqueue_style( 'hfg-style' );

wp_enqueue_script(
'hfg-theme-functions',
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit a0fc0e2

Please sign in to comment.