Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
raky291 committed Jun 19, 2020
1 parent 7a22ff9 commit 6b6165d
Show file tree
Hide file tree
Showing 7 changed files with 5,074 additions and 3,496 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto eol=lf
package-lock.json binary
4 changes: 1 addition & 3 deletions .postcssrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {
cascade: false,
},
autoprefixer: { cascade: false },
},
};
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# R9 UnderStrap Child Theme

[![github action: tests](https://github.com/raky291/r9-understrap-child/workflows/Tests/badge.svg)](https://github.com/raky291/r9-understrap-child/actions)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![GitHub Actions: Tests](https://github.com/raky291/r9-understrap-child/workflows/Tests/badge.svg)](https://github.com/raky291/r9-understrap-child/actions)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
14 changes: 6 additions & 8 deletions includes/class-r9-understrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ public function __construct()

public function add_scripts()
{
$this->r9_enqueue_style('r9-understrap-styles', '/wwwroot/dist/css/main.css');
$this->r9_enqueue_script('r9-understrap-scripts', '/wwwroot/dist/js/main.js', array('jquery'));
$this->enqueue_style('r9-understrap-styles', '/wwwroot/dist/css/main.css');
$this->enqueue_script('r9-understrap-scripts', '/wwwroot/dist/js/main.js', array('jquery'));
}

public function add_inline_scripts()
{
$wordpress_public_path = __R9_UNDERSTRAP_URL__ . '/wwwroot/dist/';

wp_add_inline_script(
'r9-understrap-scripts',
sprintf("window.wordpress_public_path = '%s';", $wordpress_public_path),
sprintf("window.wordpress_public_path = '%s';", __R9_UNDERSTRAP_URL__ . '/wwwroot/dist/'),
'before'
);
}
Expand All @@ -45,17 +43,17 @@ public function move_scripts()
wp_script_add_data('jquery-migrate', 'group', 1);
}

private function r9_enqueue_style($handle, $src)
private function enqueue_style($handle, $src, $deps = array())
{
wp_enqueue_style(
$handle,
__R9_UNDERSTRAP_URL__ . $src,
array(),
$deps,
filemtime(__R9_UNDERSTRAP_DIR__ . $src)
);
}

private function r9_enqueue_script($handle, $src, $deps)
private function enqueue_script($handle, $src, $deps = array())
{
wp_enqueue_script(
$handle,
Expand Down
Loading

0 comments on commit 6b6165d

Please sign in to comment.