Remove JS image loader for URL

This commit is contained in:
Justin Foell
2020-02-28 13:40:31 -06:00
parent 5f9849214a
commit fbfb4953e4
5 changed files with 21 additions and 23 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

+1 -2
View File
@@ -9,7 +9,6 @@
"start": "wp-scripts start"
},
"devDependencies": {
"@wordpress/scripts": "6.1.0",
"url-loader": "^3.0.0"
"@wordpress/scripts": "6.1.0"
}
}
+8
View File
@@ -215,6 +215,14 @@ class WPStrava {
filemtime( WPSTRAVA_PLUGIN_DIR . 'build/style.css' )
);
wp_localize_script(
'wp-strava-block',
'wpStrava',
array(
'placeholderActivityImg' => WPSTRAVA_PLUGIN_URL . 'images/example-activity.png',
)
);
foreach ( $blocks as $block_class ) {
$block = new $block_class();
$block->register_block();
+12 -4
View File
@@ -1,10 +1,18 @@
/* global wp, wpStrava */
import { registerBlockType } from '@wordpress/blocks';
import ActivityImage from './activity.png';
/**
* Localized Data.
*/
const {
placeholderActivityImg,
} = wpStrava;
registerBlockType( 'wp-strava/activity', {
title: 'Strava Activity',
icon: 'chart-line',
category: 'widgets',
edit: () => <img className="wp-strava-img" src={ActivityImage} />,
save: () => <div>Hola, mundo!</div>,
category: 'embed',
edit: () => <img className="wp-strava-img" src={placeholderActivityImg} />,
save: () => <img className="wp-strava-img" src={placeholderActivityImg} />,
} );
-17
View File
@@ -1,17 +0,0 @@
const defaultConfig = require("./node_modules/@wordpress/scripts/config/webpack.config");
module.exports = {
...defaultConfig,
module: {
...defaultConfig.module,
rules: [
...defaultConfig.module.rules,
{
test: /\.(png|jpg)$/,
use: {
loader: "url-loader"
}
}
]
}
};