Business Profile - Version 1.2

Version Description

(2018-12-11) = * Add gutenberg block for the contact card

Download this release

Release Info

Developer NateWr
Plugin Icon 128x128 Business Profile
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.5 to 1.2

assets/js/block-contact-card.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const { __ } = wp.i18n;
2
+ const { registerBlockType } = wp.blocks;
3
+ const { SelectControl, CheckboxControl, PanelBody, ServerSideRender, Disabled } = wp.components;
4
+ const { InspectorControls } = wp.editor;
5
+ const { locationOptions } = bpfwp_blocks;
6
+
7
+ registerBlockType( 'business-profile/contact-card', {
8
+ title: __( 'Contact Card', 'business-profile' ),
9
+ category: 'widgets',
10
+ icon: 'location',
11
+ attributes: {
12
+ location: {
13
+ type: 'number',
14
+ default: 0
15
+ },
16
+ show_name: {
17
+ type: 'boolean',
18
+ default: true
19
+ },
20
+ show_address: {
21
+ type: 'boolean',
22
+ default: true
23
+ },
24
+ show_get_directions: {
25
+ type: 'boolean',
26
+ default: true
27
+ },
28
+ show_phone: {
29
+ type: 'boolean',
30
+ default: true
31
+ },
32
+ show_contact: {
33
+ type: 'boolean',
34
+ default: true
35
+ },
36
+ show_opening_hours: {
37
+ type: 'boolean',
38
+ default: true
39
+ },
40
+ show_opening_hours_brief: {
41
+ type: 'boolean',
42
+ default: false
43
+ },
44
+ show_map: {
45
+ type: 'boolean',
46
+ default: true
47
+ }
48
+ },
49
+ supports: {
50
+ html: false,
51
+ },
52
+ edit( { attributes, setAttributes } ) {
53
+
54
+ return (
55
+ <div>
56
+ <InspectorControls>
57
+ <PanelBody>
58
+ {locationOptions.length ? (
59
+ <SelectControl
60
+ label={ __( 'Select a Location', 'business-profile' ) }
61
+ value={ attributes.location }
62
+ onChange={ ( location ) => setAttributes( { location } ) }
63
+ options={ locationOptions }
64
+ />
65
+ ) : ''}
66
+ <CheckboxControl
67
+ label={ __( 'Show Name', 'business-profile') }
68
+ checked={ attributes.show_name }
69
+ onChange={ ( show_name ) => { setAttributes( { show_name } ) } }
70
+ />
71
+ <CheckboxControl
72
+ label={ __( 'Show Address', 'business-profile') }
73
+ checked={ attributes.show_address }
74
+ onChange={ ( show_address ) => { setAttributes( { show_address } ) } }
75
+ />
76
+ <CheckboxControl
77
+ label={ __( 'Show link to get directions on Google Maps', 'business-profile') }
78
+ checked={ attributes.show_get_directions }
79
+ onChange={ ( show_get_directions ) => { setAttributes( { show_get_directions } ) } }
80
+ />
81
+ <CheckboxControl
82
+ label={ __( 'Show Phone number', 'business-profile') }
83
+ checked={ attributes.show_phone }
84
+ onChange={ ( show_phone ) => { setAttributes( { show_phone } ) } }
85
+ />
86
+ <CheckboxControl
87
+ label={ __( 'Show contact details', 'business-profile') }
88
+ checked={ attributes.show_contact }
89
+ onChange={ ( show_contact ) => { setAttributes( { show_contact } ) } }
90
+ />
91
+ <CheckboxControl
92
+ label={ __( 'Show Opening Hours', 'business-profile') }
93
+ checked={ attributes.show_opening_hours }
94
+ onChange={ ( show_opening_hours ) => { setAttributes( { show_opening_hours } ) } }
95
+ />
96
+ <CheckboxControl
97
+ label={ __( 'Show brief opening hours on one line', 'business-profile') }
98
+ checked={ attributes.show_opening_hours_brief }
99
+ onChange={ ( show_opening_hours_brief ) => { setAttributes( { show_opening_hours_brief } ) } }
100
+ />
101
+ <CheckboxControl
102
+ label={ __( 'Show Google Map', 'business-profile') }
103
+ checked={ attributes.show_map }
104
+ onChange={ ( show_map ) => { setAttributes( { show_map } ) } }
105
+ />
106
+ </PanelBody>
107
+ </InspectorControls>
108
+ <Disabled>
109
+ <ServerSideRender block="business-profile/contact-card" attributes={ attributes } />
110
+ </Disabled>
111
+ </div>
112
+ );
113
+ },
114
+ save() {
115
+ return null;
116
+ },
117
+ } );
assets/js/blocks.build.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){function n(t){if(o[t])return o[t].exports;var l=o[t]={i:t,l:!1,exports:{}};return e[t].call(l.exports,l,l.exports,n),l.l=!0,l.exports}var o={};n.m=e,n.c=o,n.d=function(e,o,t){n.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(o,"a",o),o},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,o){e.exports=o(1)},function(e,n){var o=wp.i18n.__,t=wp.blocks.registerBlockType,l=wp.components,s=l.SelectControl,r=l.CheckboxControl,a=l.PanelBody,i=l.ServerSideRender,c=l.Disabled,p=wp.editor.InspectorControls,u=bpfwp_blocks,h=u.locationOptions;t("business-profile/contact-card",{title:o("Contact Card","business-profile"),category:"widgets",icon:"location",attributes:{location:{type:"number",default:0},show_name:{type:"boolean",default:!0},show_address:{type:"boolean",default:!0},show_get_directions:{type:"boolean",default:!0},show_phone:{type:"boolean",default:!0},show_contact:{type:"boolean",default:!0},show_opening_hours:{type:"boolean",default:!0},show_opening_hours_brief:{type:"boolean",default:!1},show_map:{type:"boolean",default:!0}},supports:{html:!1},edit:function(e){var n=e.attributes,t=e.setAttributes;return wp.element.createElement("div",null,wp.element.createElement(p,null,wp.element.createElement(a,null,h.length?wp.element.createElement(s,{label:o("Select a Location","business-profile"),value:n.location,onChange:function(e){return t({location:e})},options:h}):"",wp.element.createElement(r,{label:o("Show Name","business-profile"),checked:n.show_name,onChange:function(e){t({show_name:e})}}),wp.element.createElement(r,{label:o("Show Address","business-profile"),checked:n.show_address,onChange:function(e){t({show_address:e})}}),wp.element.createElement(r,{label:o("Show link to get directions on Google Maps","business-profile"),checked:n.show_get_directions,onChange:function(e){t({show_get_directions:e})}}),wp.element.createElement(r,{label:o("Show Phone number","business-profile"),checked:n.show_phone,onChange:function(e){t({show_phone:e})}}),wp.element.createElement(r,{label:o("Show contact details","business-profile"),checked:n.show_contact,onChange:function(e){t({show_contact:e})}}),wp.element.createElement(r,{label:o("Show Opening Hours","business-profile"),checked:n.show_opening_hours,onChange:function(e){t({show_opening_hours:e})}}),wp.element.createElement(r,{label:o("Show brief opening hours on one line","business-profile"),checked:n.show_opening_hours_brief,onChange:function(e){t({show_opening_hours_brief:e})}}),wp.element.createElement(r,{label:o("Show Google Map","business-profile"),checked:n.show_map,onChange:function(e){t({show_map:e})}}))),wp.element.createElement(c,null,wp.element.createElement(i,{block:"business-profile/contact-card",attributes:n})))},save:function(){return null}})}]);
business-profile.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Business Profile
4
  * Plugin URI: http://themeofthecrop.com
5
  * Description: Contact information, Google Maps and opening hours made easy for businesses.
6
- * Version: 1.1.5
7
  * Author: Theme of the Crop
8
  * Author URI: http://themeofthecrop.com
9
  * License: GNU General Public License v2.0 or later
@@ -89,7 +89,7 @@ if ( ! class_exists( 'bpfwpInit', false ) ) :
89
  define( 'BPFWP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
90
  define( 'BPFWP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
91
  define( 'BPFWP_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
92
- define( 'BPFWP_VERSION', '1.1.5' );
93
  }
94
 
95
  /**
@@ -100,6 +100,7 @@ if ( ! class_exists( 'bpfwpInit', false ) ) :
100
  * @return void
101
  */
102
  protected function includes() {
 
103
  require_once BPFWP_PLUGIN_DIR . '/includes/class-compatibility.php';
104
  require_once BPFWP_PLUGIN_DIR . '/includes/class-custom-post-types.php';
105
  require_once BPFWP_PLUGIN_DIR . '/includes/deprecated/class-integrations.php';
@@ -120,7 +121,9 @@ if ( ! class_exists( 'bpfwpInit', false ) ) :
120
  new bpfwpIntegrations(); // Deprecated in v1.1.
121
  $this->settings = new bpfwpSettings();
122
  $this->cpts = new bpfwpCustomPostTypes();
 
123
 
 
124
  if ( $this->settings->get_setting( 'multiple-locations' ) ) {
125
  $this->cpts->run();
126
  }
3
  * Plugin Name: Business Profile
4
  * Plugin URI: http://themeofthecrop.com
5
  * Description: Contact information, Google Maps and opening hours made easy for businesses.
6
+ * Version: 1.2
7
  * Author: Theme of the Crop
8
  * Author URI: http://themeofthecrop.com
9
  * License: GNU General Public License v2.0 or later
89
  define( 'BPFWP_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
90
  define( 'BPFWP_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
91
  define( 'BPFWP_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
92
+ define( 'BPFWP_VERSION', '1.2' );
93
  }
94
 
95
  /**
100
  * @return void
101
  */
102
  protected function includes() {
103
+ require_once BPFWP_PLUGIN_DIR . '/includes/class-blocks.php';
104
  require_once BPFWP_PLUGIN_DIR . '/includes/class-compatibility.php';
105
  require_once BPFWP_PLUGIN_DIR . '/includes/class-custom-post-types.php';
106
  require_once BPFWP_PLUGIN_DIR . '/includes/deprecated/class-integrations.php';
121
  new bpfwpIntegrations(); // Deprecated in v1.1.
122
  $this->settings = new bpfwpSettings();
123
  $this->cpts = new bpfwpCustomPostTypes();
124
+ $this->blocks = new bpfwpBlocks();
125
 
126
+ $this->blocks->run();
127
  if ( $this->settings->get_setting( 'multiple-locations' ) ) {
128
  $this->cpts->run();
129
  }
includes/class-blocks.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Methods for handling blocks in the Gutenberg editor
4
+ *
5
+ * @package BusinessProfile
6
+ * @copyright Copyright (c) 2018, Theme of the Crop
7
+ * @license GPL-2.0+
8
+ * @since 1.2.0
9
+ */
10
+
11
+ defined( 'ABSPATH' ) || exit;
12
+
13
+ if ( ! class_exists( 'bpfwpBlocks', false ) ) :
14
+
15
+ /**
16
+ * Class to create, edit and display blocks for the Gutenberg editor
17
+ *
18
+ * @since 1.2
19
+ */
20
+ class bpfwpBlocks {
21
+
22
+ /**
23
+ * Register hooks
24
+ *
25
+ * @since 1.2
26
+ * @access public
27
+ * @return void
28
+ */
29
+ public function run() {
30
+ add_action( 'init', array( $this, 'register' ) );
31
+ }
32
+
33
+ /**
34
+ * Register blocks
35
+ *
36
+ * @since 1.1
37
+ * @access public
38
+ * @return void
39
+ */
40
+ public function register() {
41
+
42
+ if ( !function_exists( 'register_block_type' ) ) {
43
+ return;
44
+ }
45
+
46
+ wp_register_script(
47
+ 'business-profile-blocks',
48
+ BPFWP_PLUGIN_URL . '/assets/js/blocks.build.js',
49
+ array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor' )
50
+ );
51
+
52
+ wp_register_script(
53
+ 'bpfwp-map',
54
+ BPFWP_PLUGIN_URL . '/assets/js/map.js',
55
+ array( 'jquery' ),
56
+ BPFWP_VERSION,
57
+ true
58
+ );
59
+
60
+ wp_register_style(
61
+ 'bpfwp-default',
62
+ BPFWP_PLUGIN_URL . '/assets/css/contact-card.css',
63
+ array()
64
+ );
65
+
66
+ register_block_type( 'business-profile/contact-card', array(
67
+ 'editor_script' => ['business-profile-blocks', 'bpfwp-map'],
68
+ 'editor_style' => 'bpfwp-default',
69
+ 'render_callback' => 'bpwfwp_print_contact_card',
70
+ 'attributes' => array(
71
+ 'location' => array(
72
+ 'type' => 'number',
73
+ 'minimum' => '0',
74
+ ),
75
+ 'show_name' => array(
76
+ 'type' => 'boolean',
77
+ 'default' => true,
78
+ ),
79
+ 'show_address' => array(
80
+ 'type' => 'boolean',
81
+ 'default' => true,
82
+ ),
83
+ 'show_get_directions' => array(
84
+ 'type' => 'boolean',
85
+ 'default' => true,
86
+ ),
87
+ 'show_phone' => array(
88
+ 'type' => 'boolean',
89
+ 'default' => true,
90
+ ),
91
+ 'show_contact' => array(
92
+ 'type' => 'boolean',
93
+ 'default' => true,
94
+ ),
95
+ 'show_opening_hours' => array(
96
+ 'type' => 'boolean',
97
+ 'default' => true,
98
+ ),
99
+ 'show_opening_hours_brief' => array(
100
+ 'type' => 'boolean',
101
+ 'default' => false,
102
+ ),
103
+ 'show_map' => array(
104
+ 'type' => 'boolean',
105
+ 'default' => true,
106
+ ),
107
+ 'show_image' => array(
108
+ 'type' => 'boolean',
109
+ 'default' => true,
110
+ ),
111
+ ),
112
+ ) );
113
+
114
+ add_action( 'admin_init', array( $this, 'register_admin' ) );
115
+ }
116
+
117
+ /**
118
+ * Register admin-only assets for block handling
119
+ *
120
+ * @since 1.2
121
+ * @access public
122
+ * @return void
123
+ */
124
+ public function register_admin() {
125
+
126
+ global $bpfwp_controller;
127
+
128
+ $location_options = array();
129
+
130
+ if ( $bpfwp_controller->settings->get_setting( 'multiple-locations' ) ) {
131
+ $locations = new WP_Query( array(
132
+ 'post_type' => $bpfwp_controller->cpts->location_cpt_slug,
133
+ 'posts_per_page' => 1000,
134
+ 'post_status' => 'publish',
135
+ ) );
136
+
137
+ $location_options = array( array(
138
+ 'value' => 0,
139
+ 'label' => __('Use the main Business Profile'),
140
+ ) );
141
+ while ( $locations->have_posts() ) {
142
+ $locations->the_post();
143
+ $location_options[] = array(
144
+ 'value' => get_the_ID(),
145
+ 'label' => get_the_title(),
146
+ );
147
+ }
148
+ wp_reset_postdata();
149
+ }
150
+
151
+ wp_add_inline_script(
152
+ 'business-profile-blocks',
153
+ sprintf(
154
+ 'var bpfwp_blocks = %s;',
155
+ json_encode( array(
156
+ 'locationOptions' => $location_options,
157
+ ) )
158
+ ),
159
+ 'before'
160
+ );
161
+ }
162
+ }
163
+ endif;
includes/class-custom-post-types.php CHANGED
@@ -73,6 +73,7 @@ if ( ! class_exists( 'bpfwpCustomPostTypes', false ) ) :
73
  ),
74
  'public' => true,
75
  'show_in_menu' => 'bpfwp-locations',
 
76
  'has_archive' => true,
77
  'supports' => array( 'title', 'editor', 'thumbnail' ),
78
  );
73
  ),
74
  'public' => true,
75
  'show_in_menu' => 'bpfwp-locations',
76
+ 'show_in_rest' => true,
77
  'has_archive' => true,
78
  'supports' => array( 'title', 'editor', 'thumbnail' ),
79
  );
package.json CHANGED
@@ -1,16 +1,26 @@
1
  {
2
  "name": "business-profile",
3
  "description": "Contact information, Google Maps and opening hours made easy for businesses.",
4
- "version": "1.1.5",
5
  "author": {
6
  "name": "Theme of the Crop",
7
  "url": "https://themeofthecrop.com"
8
  },
 
 
 
 
9
  "devDependencies": {
 
 
 
 
 
10
  "grunt": "~1.0.0",
11
- "grunt-contrib-compress": "~1.4.1",
12
  "grunt-contrib-jshint": "~1.0.0",
13
  "grunt-contrib-watch": "~1.0.0",
14
- "grunt-wp-i18n": "~0.5.4"
 
15
  }
16
  }
1
  {
2
  "name": "business-profile",
3
  "description": "Contact information, Google Maps and opening hours made easy for businesses.",
4
+ "version": "1.2.0",
5
  "author": {
6
  "name": "Theme of the Crop",
7
  "url": "https://themeofthecrop.com"
8
  },
9
+ "scripts": {
10
+ "build": "cross-env BABEL_ENV=default NODE_ENV=production webpack",
11
+ "dev": "cross-env BABEL_ENV=default webpack --watch"
12
+ },
13
  "devDependencies": {
14
+ "babel-core": "^6.25.0",
15
+ "babel-loader": "^7.1.1",
16
+ "babel-plugin-transform-react-jsx": "^6.24.1",
17
+ "babel-preset-env": "^1.6.0",
18
+ "cross-env": "^5.0.1",
19
  "grunt": "~1.0.0",
20
+ "grunt-contrib-compress": "~1.3.0",
21
  "grunt-contrib-jshint": "~1.0.0",
22
  "grunt-contrib-watch": "~1.0.0",
23
+ "grunt-wp-i18n": "~0.5.4",
24
+ "webpack": "^3.1.0"
25
  }
26
  }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: NateWr, fatmedia
3
  Author URI: https://github.com/NateWr
4
  Plugin URL: http://themeofthecrop.com
5
  Requires at Least: 4.4
6
- Tested Up To: 4.9.8
7
  Tags: business profile, seo, local seo, schema, address, google map, contact, phone
8
- Stable tag: 1.1.5
9
  License: GPLv2 or later
10
  Donate link: http://themeofthecrop.com
11
 
@@ -13,7 +13,7 @@ Display your business's contact details with seo-friendly Schema.org markup. Sup
13
 
14
  == Description ==
15
 
16
- Add your business contact details to your site with seo-friendly Schema.org markup. This plugin adds a Contact Card widget and a `[contact-card]` shortcode. You can use these to display the following on any page:
17
 
18
  * Business name
19
  * Address
@@ -27,7 +27,7 @@ Schema.org markup helps search engines like Google discover your address, phone
27
 
28
  Supports [multi-location businesses](http://doc.themeofthecrop.com/plugins/business-profile/user/getting-started/locations) with a custom Locations post type.
29
 
30
- This plugin is part of a suite of products that help restaurants build better websites. Get the [best WordPress restaurant themes](https://themeofthecrop.com/themes/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile), as well as plugins that help restaurants [take online reservations](https://themeofthecrop.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile) and build [responsive online menus](https://themeofthecrop.com/plugins/food-and-drink-menu/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile) at [Theme of the Crop](https://themeofthecrop.com/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile).
31
 
32
  = How to use =
33
 
@@ -82,9 +82,13 @@ You'll find more help in the [User Guide](http://doc.themeofthecrop.com/plugins/
82
  2. An easy-to-use form lets you add all of the information, locate the correct map coordinates and set up your opening hours.
83
  3. Choose what information to display with the widget, or check out the shortcode attributes in the help document included.
84
  4. Optional multi-location support to easily display all of your locations.
 
85
 
86
  == Changelog ==
87
 
 
 
 
88
  = 1.1.5 (2018-09-26) =
89
  * Fix: Address coordinate lookups need to be https:// and use api key
90
 
3
  Author URI: https://github.com/NateWr
4
  Plugin URL: http://themeofthecrop.com
5
  Requires at Least: 4.4
6
+ Tested Up To: 5.0
7
  Tags: business profile, seo, local seo, schema, address, google map, contact, phone
8
+ Stable tag: 1.2
9
  License: GPLv2 or later
10
  Donate link: http://themeofthecrop.com
11
 
13
 
14
  == Description ==
15
 
16
+ Add your business contact details to your site with seo-friendly Schema.org markup. This plugin adds a Contact Card block for the Gutenberg editor, a widget and a `[contact-card]` shortcode. You can use these to display the following on any page:
17
 
18
  * Business name
19
  * Address
27
 
28
  Supports [multi-location businesses](http://doc.themeofthecrop.com/plugins/business-profile/user/getting-started/locations) with a custom Locations post type.
29
 
30
+ This plugin is part of a suite of plugins for restaurants. [Take online reservations](https://themeofthecrop.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile) and build [responsive online menus](https://themeofthecrop.com/plugins/food-and-drink-menu/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile) at [Theme of the Crop](https://themeofthecrop.com/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Business%20Profile).
31
 
32
  = How to use =
33
 
82
  2. An easy-to-use form lets you add all of the information, locate the correct map coordinates and set up your opening hours.
83
  3. Choose what information to display with the widget, or check out the shortcode attributes in the help document included.
84
  4. Optional multi-location support to easily display all of your locations.
85
+ 5. Add a contact card to any page or post with the block.
86
 
87
  == Changelog ==
88
 
89
+ = 1.2 (2018-12-11) =
90
+ * Add gutenberg block for the contact card
91
+
92
  = 1.1.5 (2018-09-26) =
93
  * Fix: Address coordinate lookups need to be https:// and use api key
94
 
screenshot-5.png ADDED
Binary file
webpack.config.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ let webpack = require( 'webpack' ),
2
+ NODE_ENV = process.env.NODE_ENV || 'development',
3
+ webpackConfig = {
4
+ entry: [
5
+ './assets/js/block-contact-card.js',
6
+ ],
7
+ output: {
8
+ path: __dirname,
9
+ filename: './assets/js/blocks.build.js',
10
+ },
11
+ module: {
12
+ loaders: [
13
+ {
14
+ test: /.js$/,
15
+ loader: 'babel-loader',
16
+ exclude: /node_modules/,
17
+ },
18
+ ],
19
+ },
20
+ plugins: [
21
+ new webpack.DefinePlugin( {
22
+ 'process.env.NODE_ENV': JSON.stringify( NODE_ENV ),
23
+ } ),
24
+ ],
25
+ };
26
+
27
+ if ( 'production' === NODE_ENV ) {
28
+ webpackConfig.plugins.push( new webpack.optimize.UglifyJsPlugin() );
29
+ }
30
+
31
+ module.exports = webpackConfig;