Gathering detailed insights and metrics for bms-webpack-js-example
Gathering detailed insights and metrics for bms-webpack-js-example
Gathering detailed insights and metrics for bms-webpack-js-example
Gathering detailed insights and metrics for bms-webpack-js-example
npm install bms-webpack-js-example
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
35
The goal of this tool is to allow us as developers the option to use ES6 and/or typescript if we so choose. The goal of this is to just enable us to have more options available to us if we so desire. For medium/large projects, this scaffold may be a viable option as having access to modules and code reuse can hasten our development time/workflow. This current example showcases ES6 with JavaScript.
1*___jb_old___* 2*___jb_tmp___* 3*.lock 4.DS_Store 5theme.lock 6config.yml 7settings_data.json 8.idea/ 9.vscode/ 10node_modules/ 11src/node_modules 12locksmith-content-variables.liquid 13locksmith-variables.liquid 14locksmith.liquid 15bold-common.liquid 16*.shogun.* 17config.*.yml 18*.cache* 19src/dist/* 20
Ensure you are within the src directory, from project root cd src
Install node dependencies
1# Run this if you are using yarn 2$ yarn 3 4# Or run this if you are using npm 5$ npm install
This project relies on webpack in order to build the file into a bundle. For configuration options, and file naming, will need to change the following webpack.config.js
The main point of interest within this file is the following:
1module.exports = { 2 entry: { 3 BMSBlackFridayCoupons: './builds/BMS-BlackFridayCoupons.js' 4 //something: './builds/anotherEntryPoint.js' 5 },
The key for the object entry, will be the name of the bundle that will be placed within the shopify assets/
directory.
So For example: BMSBlackFridayCoupons: './builds/BMS-BlackFridayCoupons.js'
This takes the file found at the location /src/builds/BMS-BlackFridayCoupons.js
and bundles it, outputing it at the location of /assets/BMSBlackFridayCoupons.bundle.js
This is because of the specified output within webpack.config.js
1 output: { 2 filename: '[name].bundle.js', 3 path: path.resolve(__dirname, '../assets') 4 }
1# Run this if you are using yarn 2$ yarn start 3 4# Or run this if you are using npm 5$ npm start
This will start watching for file changes related to the entry point for the files being watched.
This command concurrently runs theme watch (for the default development:
) environment from config.yml
This in short allows to develop the files within es6, and then have the bundle be uploaded concurrently.
To create a production build (Which minifies and optimizes the bundle code) , run the following command
1# Run this if you are using yarn 2$ yarn build 3# Or run this if you are using npm 4$ npm run build
This will create a javascript file in the /dist folder, this is for compiling the Typescript into Javascript. The bundled JavaScript is then automatically moved to the assets folder, as a minified bundle. Once this command has completed, it will then run bmstk
This will then upload the bundled assets to the store. For more information on bmstk please see here
Read the Full Usage guide (Coming soon?)
No vulnerabilities found.
No security vulnerabilities found.