diff --git a/gruntfile.js b/gruntfile.js index 1cf284df..d3680251 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -73,6 +73,12 @@ module.exports = function( grunt ) { src: [ '**/*', '!assets/*' ], dest: 'build/', expand: true + }, + dependencies: { + cwd: 'node_modules/clipboard/dist/', + src: [ '**/*.min.js' ], + dest: 'build/assets/javascript/', + expand: true } }, jscs: { diff --git a/package.json b/package.json index 693c2180..ef1f4743 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "devDependencies": { "@wordpress/browserslist-config": "^2.3.0", "autoprefixer": "^7.1.2", + "clipboard": "^2.0.4", "grunt": "~1.0.1", "grunt-check-dependencies": "~1.0.0", "grunt-checktextdomain": "~1.0.1", diff --git a/src/includes/class-health-check.php b/src/includes/class-health-check.php index 111ba096..c3c88372 100644 --- a/src/includes/class-health-check.php +++ b/src/includes/class-health-check.php @@ -285,6 +285,10 @@ public function enqueues() { } } + if ( ! wp_script_is( 'clipboard', 'registered' ) ) { + wp_register_script( 'clipboard', trailingslashit( HEALTH_CHECK_PLUGIN_URL ) . 'assets/javascript/clipboard.min.js', array(), '2.0.4' ); + } + wp_enqueue_style( 'health-check', trailingslashit( HEALTH_CHECK_PLUGIN_URL ) . 'assets/css/health-check.css', array(), HEALTH_CHECK_PLUGIN_VERSION ); wp_enqueue_script( 'health-check', trailingslashit( HEALTH_CHECK_PLUGIN_URL ) . 'assets/javascript/health-check.js', array( 'jquery', 'wp-a11y', 'clipboard', 'wp-util' ), HEALTH_CHECK_PLUGIN_VERSION, true );