Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Commit

Permalink
Merge pull request #4 from wp-graphql/feature/add-dir-constant
Browse files Browse the repository at this point in the history
Define constant for the plugin dir url, to make it easier to enqueue …
  • Loading branch information
jasonbahl authored Jan 29, 2018
2 parents 0d3de72 + 90c27cf commit 95e86a4
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/
*.sql
*.tar.gz
*.zip
.idea*
4 changes: 2 additions & 2 deletions assets/app/build/asset-manifest.json
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"main.css": "static/css/main.b25a6b44.css",
"main.css.map": "static/css/main.b25a6b44.css.map",
"main.js": "static/js/main.44364570.js",
"main.js.map": "static/js/main.44364570.js.map"
"main.js": "static/js/main.6ad70e09.js",
"main.js.map": "static/js/main.6ad70e09.js.map"
}
Binary file removed assets/app/build/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion assets/app/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>React App</title><link href="/static/css/main.b25a6b44.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="wp-graphiql"></div><script type="text/javascript" src="/static/js/main.44364570.js"></script></body></html>
<head><link href="/static/css/main.b25a6b44.css" rel="stylesheet"></head><script type="text/javascript" src="/static/js/main.6ad70e09.js"></script>
15 changes: 0 additions & 15 deletions assets/app/build/manifest.json

This file was deleted.

2 changes: 1 addition & 1 deletion assets/app/build/service-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file modified assets/app/build/static/css/main.b25a6b44.css
100755 → 100644
Empty file.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "app",
"name": "wp-graphiql",
"version": "0.0.1",
"private": true,
"devDependencies": {
Expand Down
9 changes: 6 additions & 3 deletions wp-graphiql.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
class WPGraphiQL {

public function init() {
if ( ! defined( 'WPGRAPHIQL_PLUGIN_DIR' ) ) {
define( 'WPGRAPHIQL_PLUGIN_DIR', plugin_dir_url( __FILE__ ) );
}
add_action( 'admin_menu', [ $this, 'register_admin_page' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_react_app' ] );
}
Expand Down Expand Up @@ -72,7 +75,7 @@ public function get_app_stylesheet() {
if ( empty( $manifest['main.css'] ) ) {
return '';
}
return plugins_url( 'wp-graphiql/assets/app/build/' . $manifest['main.css'] );
return WPGRAPHIQL_PLUGIN_DIR . 'assets/app/build/' . $manifest['main.css'];
}

/**
Expand All @@ -85,15 +88,15 @@ public function get_app_script() {
if ( empty( $manifest['main.js'] ) ) {
return '';
}
return plugins_url( 'wp-graphiql/assets/app/build/' . $manifest['main.js'] );
return WPGRAPHIQL_PLUGIN_DIR . 'assets/app/build/' . $manifest['main.js'];
}

public function get_app_script_helpers() {
$manifest = $this->get_app_manifest();
if ( empty( $manifest['main.js'] ) ) {
return '';
}
return plugins_url( 'wp-graphiql/assets/js/wp-graphiql-helpers.js' );
return WPGRAPHIQL_PLUGIN_DIR . 'assets/js/wp-graphiql-helpers.js';
}

/**
Expand Down

0 comments on commit 95e86a4

Please sign in to comment.