BigCommerce: Vue SDK - Install
Overview
The integration of Hawksearch using Vue.js is done by using the Hawksearch Vue SDK. It is a publicly distributed NPM package that is included as a dependency to the BigCommerce theme. The default Cornerstone theme is used in the following examples.
Â
Prerequisite
Node.js version 11.0.0 or higher
NPM version 6.0.0 or higher
A Stencil theme
Stencil CLI
Â
Steps to install
Install the package in your theme using the command shell
npm install git+https://github.com/hawksearch/vue-hawksearch.git#latest
Create a directory in your assets folder to include Vue.js resources (e.g. assets/js/hawksearch/vue).
Create an index.js (e.g. assets/js/hawksearch/vue/index.js). It will include all necessary initializations and custom work that will be included in the later articles. At this point, the main class can be imported at the top of the file.
assets/js/hawksearch/vue/index.jsimport HawksearchVue from '@hawksearch/vue';
Â
The initialization script should be included in theme scripts. The recommended approach is to include it in the theme app.js to maintain a single bundle structure. To do this the index.js must include a function export.
assets/js/hawksearch/vue/index.jsimport HawksearchVue from '@hawksearch/vue'; // Other imports ... export default function () { // Initialization code goes here }
assets/js/app.jsÂ
The vue instance is also required for any additional customization, so it is a good practice to add it to the webpack config.
webpack.common.jsThe package has default styles that are available from @hawksearch/vue/dist/vue-hawksearch.css and should be included and used as a base for further development.
Run the stencil development environment to build the resources and review progress.
Live Previewing a Theme - Stencil CLI - Stencil Docs
Â
Next steps
BigCommerce: Vue SDK - Setup configuration
Â